diff options
author | bobzel <zzzman@gmail.com> | 2022-10-17 19:07:32 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2022-10-17 19:07:32 -0400 |
commit | b772fb95bb2f980f91da44d1442f52c4fb0b6eac (patch) | |
tree | 344a800d6625d330d47ceb6e2197db35dbe6c723 /src/Utils.ts | |
parent | a26f7793c7626da5551774ac9911db1da34affec (diff) |
added rotation around an arbitrary point to doc decos. fixed show title for func plots and for shared docs in novice mode.
Diffstat (limited to 'src/Utils.ts')
-rw-r--r-- | src/Utils.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index 6fc00040f..bf1f72774 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -243,6 +243,10 @@ export namespace Utils { return [Math.sqrt((ys2 - ye) * (ys2 - ye) + (x2 - x) * (x2 - x)), [x, ye, x, ye]]; } + export function rotPt(x: number, y: number, radAng: number) { + return { x: x * Math.cos(radAng) - y * Math.sin(radAng), y: x * Math.sin(radAng) + y * Math.cos(radAng) }; + } + function project(px: number, py: number, ax: number, ay: number, bx: number, by: number) { if (ax === bx && ay === by) return { point: { x: ax, y: ay }, left: false, dot: 0, t: 0 }; const atob = { x: bx - ax, y: by - ay }; |