mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
First implementation of element distance functions with failing tests
This commit is contained in:
parent
47cc842415
commit
d9ea7190ec
6 changed files with 275 additions and 173 deletions
|
@ -122,11 +122,11 @@ export const segmentIncludesPoint = <Point extends GenericPoint>(
|
|||
};
|
||||
|
||||
export const segmentDistanceToPoint = <Point extends GenericPoint>(
|
||||
point: Point,
|
||||
line: Segment<Point>,
|
||||
p: Point,
|
||||
s: Segment<Point>,
|
||||
) => {
|
||||
const [x, y] = point;
|
||||
const [[x1, y1], [x2, y2]] = line;
|
||||
const [x, y] = p;
|
||||
const [[x1, y1], [x2, y2]] = s;
|
||||
|
||||
const A = x - x1;
|
||||
const B = y - y1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue