mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-26 02:40:07 +02:00
Merge branch 'master' into mtolmacs/feat/fixed-point-simple-arrow-binding
This commit is contained in:
@@ -177,3 +177,19 @@ export function lineSegmentIntersectionPoints<
|
||||
|
||||
return candidate;
|
||||
}
|
||||
|
||||
export function lineSegmentsDistance<Point extends GlobalPoint | LocalPoint>(
|
||||
s1: LineSegment<Point>,
|
||||
s2: LineSegment<Point>,
|
||||
): number {
|
||||
if (lineSegmentIntersectionPoints(s1, s2)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Math.min(
|
||||
distanceToLineSegment(s1[0], s2),
|
||||
distanceToLineSegment(s1[1], s2),
|
||||
distanceToLineSegment(s2[0], s1),
|
||||
distanceToLineSegment(s2[1], s1),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user