double parameterizedPoint = lineSegment.Dot(v1) / lineSegment.Magnitude(), distance;
// Geometric interpretation:
- // pp is the paremeterized point on the vector ls where the perpendicular intersects ls.
+ // The paremeterized point on the vector ls is where the perpendicular intersects ls.
// If pp < 0, then the perpendicular lies beyond the 1st endpoint. If pp > length of ls,
// then the perpendicular lies beyond the 2nd endpoint.
Vector v = current.Unit() * length;
Vector v2 = point1 + v;
+ //bleh
+ if (!Object::fixedLength)
+ v2 = point2;
+
if (dimPoint1)
dimPoint1->SetPoint1(draggingHandle1 ? v2 : position);
// Set the length (in case the global state was set to fixed (or not))
if (Object::fixedLength)
{
-
if (draggingHandle1) // startpoint
{
Vector v = Vector(position - endpoint).Unit() * length;
Dot products:
-dp1 = n3.v2 = -by3*bx2 + bx3*by2;
-dp2 = n1.v2 = -by1*bx2 + bx1*by2;
+dp1 = n3 . v2 = -by3 * bx2 + bx3 * by2;
+dp2 = n1 . v2 = -by1 * bx2 + bx1 * by2;
-ratio = dp1/dp2;
-crossing vector = v1*rat;
+ratio = dp1 / dp2;
+crossing vector = v1 * rat;
And that's it.
+
+-----------------------------------
+
+So... to code this, let's say we have two Lines: l1 & l2.
+
+Vector v1 = l1.endpoint - l1.position;
+Vector v2 = l2.endpoint - l2.position;
+Vector v3 = v2 - v1;
+
+Vector normal1(-v1.y, v1.x);
+Vector normal3(-v3.y, v3.x);
+
+double dotProduct1 = v2.Dot(normal1);
+double dotProduct2 = v2.Dot(normal3);
+
+if (dotProduct2 == 0)
+ return ParallelLines;
+else
+{
+ // I think we'd still have to add the intersection to the position point to get the intersection...
+ Point intersection = v1 * (dotProduct1 / dotProduct2);
+ return intersection;
+}
*/