Ejemplo n.º 1
0
 public bool Intersects(AABox2D thisBox, Line2D otherLine, AABox2D otherBox)
 => thisBox.Intersects(otherBox) &&
 TouchesOrCrosses(otherLine) &&
 otherLine.TouchesOrCrosses(this);
Ejemplo n.º 2
0
 public bool Intersects(Line2D other)
 {
     // Inspired by: https://martin-thoma.com/how-to-check-if-two-line-segments-intersect/
     return(Intersects(BoundingBox(), other, other.BoundingBox()));
 }
Ejemplo n.º 3
0
 public bool TouchesOrCrosses(Line2D other)
 => IsPointOnLine(other.A) ||
 IsPointOnLine(other.B) ||
 (IsPointRightOfLine(other.A) ^ IsPointRightOfLine(other.B));