Skip to content

Commit

Permalink
add suggested constants to index.js
Browse files Browse the repository at this point in the history
implements rwaldron#5 τ
implements rwaldron#14 φ etc.
  • Loading branch information
Crissov committed Feb 10, 2020
1 parent cbec05a commit 487e4e9
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions reference-implementation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,43 @@
});
};

defineMath("SQRT2P1", Math.SQRT2 + 1);
defineMath("SQRT3", Math.sqrt(3));
defineMath("SQRT5", Math.sqrt(5));
defineMath("SQRT3_2", Math.SQRT3 / 4);
defineMath("SQRT2_3", 4 / Math.SQRT3);
defineMath("PHI", (Math.SQRT5 + 1) / 2);
defineMath("DEG_PER_RAD", Math.PI / 180);
defineMath("RAD_PER_DEG", 180 / Math.PI);
defineMath("TAU", 2 * Math.PI);
defineMath("CLOCK1", Math.PI / 6);
defineMath("CLOCK2", Math.PI / 3);
defineMath("CLOCK3", Math.PI / 2);
defineMath("CLOCK4", Math.CLOCK2 * 2);
defineMath("CLOCK5", Math.CLOCK1 * 5);
defineMath("CLOCK6", Math.PI);
defineMath("CLOCK7", Math.CLOCK1 * 7);
defineMath("CLOCK8", Math.CLOCK2 * 4);
defineMath("CLOCK9", Math.CLOCK3 * 3);
defineMath("CLOCK10", Math.CLOCK2 * 5);
defineMath("CLOCK11", Math.CLOCK1 * 11);
defineMath("CLOCK12", Math.TAU);
defineMath("NORTH", Math.TAU);
defineMath("NNE", Math.PI / 8);
defineMath("NE", Math.PI / 4);
defineMath("ENE", Math.NNE * 3);
defineMath("EAST", Math.PI / 2);
defineMath("ESE", Math.NNE * 5);
defineMath("SE", Math.NE * 3);
defineMath("SSE", Math.NNE * 7);
defineMath("SOUTH", Math.PI);
defineMath("SSW", Math.NNE * 9);
defineMath("SW", Math.NE * 5);
defineMath("WSW", Math.NNE * 11);
defineMath("WEST", Math.EAST * 3);
defineMath("WNW", Math.NNE * 13);
defineMath("NW", Math.NE * 7);
defineMath("NNW", Math.NNE * 15);

const f32A = new Float32Array(1);

Expand Down

0 comments on commit 487e4e9

Please sign in to comment.