internal static bool Inscribes(this CircularStack <KtPoint2D> points, KtSegment2D segment) { var point1In = points.Inscribes(segment.Start); var point2In = points.Inscribes(segment.End); var edges = points.ToEdges(); var intersectionCounts = edges.Count(segment.HasIntersection); if (intersectionCounts > 2) { return(false); } if (point1In && point2In) { return(intersectionCounts < 1); } if (!point1In && !point2In) { return(segment.EndLieOnSegments(edges) && points.Inscribes(segment.MidPoint())); } return((!point1In && segment.Start.LiesOnSegments(edges)) || (!point2In && segment.End.LiesOnSegments(edges))); }
internal static bool Inscribes(this CircularStack <KtPoint2D> points, CircularStack <KtPoint2D> points2) => points2.All(point => points.Inscribes(point.Value));