Ejemplo n.º 1
0
 public bool Intersects(Maths.Line line, out Vector2 intersection)
 {
     intersection = Vector2.Empty;
     if (Equation.Intersect(line, out intersection))
     {
         if (P1.Equals(intersection) || P2.Equals(intersection))
         {
             return(true);
         }
         var segLength = (P2 - P1).Length;
         //var interVec = (intersection - P1);
         var maxDist = Math.Max((intersection - P1).Length, (intersection - P2).Length);
         return(maxDist <= segLength);
     }
     return(false);
 }
Ejemplo n.º 2
0
 public LineSegment2D(Vector2 p1, Vector2 p2)
 {
     P1       = p1;
     P2       = p2;
     Equation = Maths.Line.FromPoints(p1, p2);
 }