/** <summary> Returns true if the specified line is colliding with this line. </summary> */ public bool Colliding(Line2F line) { if (IsEmpty || line.IsEmpty) { return(false); } if (!Bounds.Colliding(line.Bounds) && !IsStraight && !line.IsStraight) { return(false); } if (PointOfIntersection(line) != null) { return(true); } return(IsLineCollinear(line)); }
/** <summary> Returns true if the specified rectangle is colliding with this line. </summary> */ public bool Colliding(Rectangle2F rect) { if (IsEmpty || rect.IsEmpty) { return(false); } if (!Bounds.Colliding(rect) && !IsStraight) { return(false); } if (rect.Contains(End1)) { return(true); } foreach (Line2F l in rect.Lines) { if (Colliding(l)) { return(true); } } return(false); }