diff options
author | bobzel <zzzman@gmail.com> | 2021-12-02 13:46:17 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2021-12-02 13:46:17 -0500 |
commit | c2cd77ca1d2a67539f0af2a68c1e7336b3bc232b (patch) | |
tree | 4557b82e9e26167f3ae9d651f644dd5cad570314 /src/client/util/bezierFit.ts | |
parent | f0495cc1a050abfbaffe96b73bed24c8afe4b7b4 (diff) |
added scale factor for arrows. added control point drag to reparameterize. fixed toggling tangent lines to not happen when dragging.
Diffstat (limited to 'src/client/util/bezierFit.ts')
-rw-r--r-- | src/client/util/bezierFit.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/client/util/bezierFit.ts b/src/client/util/bezierFit.ts index 784bb2e18..8fc6de6f9 100644 --- a/src/client/util/bezierFit.ts +++ b/src/client/util/bezierFit.ts @@ -53,8 +53,11 @@ class SmartRect { } } -function Normalize(p: Point) { - const len = Math.sqrt(p.X * p.X + p.Y * p.Y); +export function Distance(p: Point) { + return Math.sqrt(p.X * p.X + p.Y * p.Y); +} +export function Normalize(p: Point) { + const len = Distance(p); return new Point(p.X / len, p.Y / len); } |