]> Shamusworld >> Repos - architektonas/blobdiff - src/line.cpp
Preliminary Delete Object tool implementation.
[architektonas] / src / line.cpp
index c2831fcf91368c3b56b8d46fbe86f4dfefc0a29a..3f4b8d4aebae8a60557a5d1660fd0c5e748b4081 100644 (file)
@@ -11,6 +11,8 @@
 // JLH  03/22/2011  Created this file
 // JLH  04/11/2011  Fixed attached dimensions to stay at correct length when
 //                  "Fixed Length" button is down
+// JLH  04/27/2011  Fixed attached dimension to stay a correct length when
+//                  "Fixed Length" button is *not* down ;-)
 //
 
 #include "line.h"
@@ -20,7 +22,7 @@
 
 Line::Line(Vector p1, Vector p2, Object * p/*= NULL*/): Object(p1, p), endpoint(p2),
        dragging(false), draggingHandle1(false), draggingHandle2(false), //needUpdate(false),
-       length(p2.Magnitude())
+       length(Vector::Magnitude(p2, p1))
 {
 }
 
@@ -209,11 +211,11 @@ Like so:
 
        if (needUpdate)
        {
-// should only do this if "Fixed Length" is set... !!! FIX !!!
+// should only do this if "Fixed Length" is set... !!! FIX !!! [DONE]
                Vector point1 = (draggingHandle1 ? endpoint : position);
                Vector point2 = (draggingHandle1 ? position : endpoint);
 
-               Vector current(point2 - point1);
+               Vector current(point2, point1);
                Vector v = current.Unit() * length;
                Vector v2 = point1 + v;
 
@@ -358,7 +360,7 @@ dp1 = n3 . v2 = -by3 * bx2 + bx3 * by2;
 dp2 = n1 . v2 = -by1 * bx2 + bx1 * by2;
 
 ratio = dp1 / dp2;
-crossing vector = v1 * rat;
+crossing vector = v1 * ratio;
 
 And that's it.