]> Shamusworld >> Repos - architektonas/blobdiff - src/geometry.cpp
Added angle snap to whole degrees, ability to manipulate Dimensions.
[architektonas] / src / geometry.cpp
index b9158974ec97d902d4ff2e936a2cc4b43e469082..b52ff7e97d058aaa7626b2568a0b667bc647c0d1 100644 (file)
@@ -255,14 +255,12 @@ void Geometry::CheckLineToCircleIntersection(Object * l, Object * c)
        // Radius is the hypotenuse, so we have to use c² = a² + b² => a² = c² - b²
        double perpendicularLength = sqrt((c->radius[0] * c->radius[0]) - (distance * distance));
 
-       // Now, find the points using the length, then check to see if they are on
-       // the line segment
+       // Now, find the intersection points using the length...
        Vector lineUnit = Vector(l->p[0], l->p[1]).Unit();
        Point i1 = p + (lineUnit * perpendicularLength);
        Point i2 = p - (lineUnit * perpendicularLength);
 
-       // Now we have our intersection points, next we need to see if they are on
-       // the line segment...
+       // Next we need to see if they are on the line segment...
        double u = ParameterOfLineAndPoint(l->p[0], l->p[1], i1);
        double v = ParameterOfLineAndPoint(l->p[0], l->p[1], i2);
 
@@ -342,3 +340,15 @@ Point Geometry::GetPointForParameter(Object * obj, double t)
        return Point(0, 0);
 }
 
+
+/*
+How to find the tangent of a point off a circle:
+
+ •  Calculate the midpoint on the point and the center of the circle
+ •  Get the length of the line segment from the and the center divided by two
+ •  Use that length to construct a circle with the point at the center and the
+    radius equal to that length
+ •  The intersection of the two circles are the tangent points
+
+*/
+