/// <summary> /// Returns a point where the line segment intersects the provided line segment. /// </summary> /// <param name="otherLine">Line segment that intersects the current line segment.</param> /// <returns></returns> public override CartesianCoordinate IntersectionCoordinate(LineSegment otherLine) { CartesianCoordinate intersection = _curve.IntersectionCoordinate(otherLine._curve); if (IncludesCoordinate(intersection) && otherLine.IncludesCoordinate(intersection)) { return(intersection); } throw new ArgumentOutOfRangeException("Segments do not intersect between starting and ending coordinates."); }
/// <summary> /// Provided line segment intersects the line segment between or on the defining points. /// </summary> /// <param name="otherLine"></param> /// <returns></returns> public override bool IsIntersecting(LineSegment otherLine) { if (!_curve.IsIntersectingCurve(otherLine._curve)) { return(false); } CartesianCoordinate intersection = _curve.IntersectionCoordinate(otherLine._curve); return(IncludesCoordinate(intersection) && otherLine.IncludesCoordinate(intersection)); }