mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: Orthogonal (elbow) arrows for diagramming (#8299)
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
parent
a133a70e87
commit
15e019706d
69 changed files with 5415 additions and 1144 deletions
|
@ -16,10 +16,22 @@ const DEFAULT_THRESHOLD = 10e-5;
|
|||
*/
|
||||
|
||||
// the two vectors are ao and bo
|
||||
export const cross = (a: Point, b: Point, o: Point) => {
|
||||
export const cross = (
|
||||
a: Readonly<Point>,
|
||||
b: Readonly<Point>,
|
||||
o: Readonly<Point>,
|
||||
) => {
|
||||
return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
|
||||
};
|
||||
|
||||
export const dot = (
|
||||
a: Readonly<Point>,
|
||||
b: Readonly<Point>,
|
||||
o: Readonly<Point>,
|
||||
) => {
|
||||
return (a[0] - o[0]) * (b[0] - o[0]) + (a[1] - o[1]) * (b[1] - o[1]);
|
||||
};
|
||||
|
||||
export const isClosed = (polygon: Polygon) => {
|
||||
const first = polygon[0];
|
||||
const last = polygon[polygon.length - 1];
|
||||
|
@ -36,7 +48,9 @@ export const close = (polygon: Polygon) => {
|
|||
|
||||
// convert radians to degress
|
||||
export const angleToDegrees = (angle: number) => {
|
||||
return (angle * 180) / Math.PI;
|
||||
const theta = (angle * 180) / Math.PI;
|
||||
|
||||
return theta < 0 ? 360 + theta : theta;
|
||||
};
|
||||
|
||||
// convert degrees to radians
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue