/// <summary> /// Checks if the segments overlap. This assumes collinearity. /// </summary> /// <param name="seg">The segment to check.</param> /// <returns>True if they overlap, false otherwise.</returns> public bool Overlaps(Seg2D seg) { double tStart = ToTime(seg.Start); double tEnd = ToTime(seg.End); return((tStart > 0.0 && tStart < 1.0) || (tEnd > 0.0 && tEnd < 1.0)); }
/// <summary> /// Checks if both segments go in the same direction, with respect for /// the Start -> End direction. /// </summary> /// <param name="seg">The other segment to compare against.</param> /// <returns>True if they go the same direction, false otherwise. /// </returns> public bool SameDirection(Seg2D seg) => SameDirection(seg.Delta);