[Uml-devel] kdesdk/umbrello/umbrello

Jonathan Riddell jri at jriddell.org
Wed Mar 19 12:45:06 UTC 2003


CVS commit by jriddell: 

reverted linepath.cpp to revision 1.4 with rounding rint()
This version caused a freeze on creating a diamond headed association (composition etc)


  M +4 -7      linepath.cpp   1.8


--- kdesdk/umbrello/umbrello/linepath.cpp  #1.7:1.8
@@ -8,5 +8,5 @@
  ***************************************************************************/
 
-#include <cmath>
+#include <math.h>
 
 #include <kdebug.h>
@@ -358,7 +358,4 @@ void LinePath::calculateHead() {
         int xb = getPoint(size -1).x();
         int yb = getPoint(size -1).y();
-        double deltaX = xb - xa;
-        double deltaY = yb - ya;
-        double hypotenuse = sqrt(deltaX*deltaX + deltaY*deltaY); // the length
         int halfLength = 10;
         double arrowAngle = 0.5 * atan(sqrt(3.0) / 3.0);
@@ -368,8 +365,8 @@ void LinePath::calculateHead() {
                 halfLength += 3;        // longer
         }
-        double slope = atan2(deltaY, deltaX);   //slope of line
-        double cosx = halfLength * deltaX/hypotenuse;
+        double slope = atan2(double(yb - ya), double(xb - xa)); //slope of line
+        double cosx = halfLength * cos(slope);
 
-        double siny = halfLength * deltaY/hypotenuse;
+        double siny = halfLength * sin(slope);
         double arrowSlope = slope + arrowAngle;
 






More information about the umbrello-devel mailing list