Skip to content

Commit

Permalink
feat(math): add cossin(), add opt scale arg for sincos()
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Nov 1, 2018
1 parent 184d55d commit 0043fb5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/math/src/angle.ts
Expand Up @@ -6,8 +6,11 @@ import {
TAU
} from "./api";

export const sincos = (theta: number) =>
[Math.sin(theta), Math.cos(theta)];
export const sincos = (theta: number, n = 1) =>
[Math.sin(theta) * n, Math.cos(theta) * n];

export const cossin = (theta: number, n = 1) =>
[Math.cos(theta) * n, Math.sin(theta) * n];

export const absTheta = (theta: number) =>
(theta %= TAU, theta < 0 ? TAU + theta : theta);
Expand Down

0 comments on commit 0043fb5

Please sign in to comment.