// 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"
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))
{
}
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;
dp2 = n1 . v2 = -by1 * bx2 + bx1 * by2;
ratio = dp1 / dp2;
-crossing vector = v1 * rat;
+crossing vector = v1 * ratio;
And that's it.