diff options
| -rw-r--r-- | instructions.html | 8 | ||||
| -rw-r--r-- | js/util.js | 12 |
2 files changed, 12 insertions, 8 deletions
diff --git a/instructions.html b/instructions.html index f0c6800..435a9d9 100644 --- a/instructions.html +++ b/instructions.html @@ -20,10 +20,10 @@ mousex, mousey <u>Math aliases</u> floor, ceil, round, abs, sign pow, exp, sqrt -sin, cos, tan -asin, acos, atan, atan2 +cos, sin, tan +acos, asin, atan, atan2 random() -E, PI +E, PI, PHI <u>convenience functions</u> clamp(n,min,max) @@ -31,7 +31,7 @@ lerp(n,a,b) mix(n,a,b) step(n,a,b) smoothstep(n,a,b) -sinp, cosp (mapped to [0,1]) +cosp, sinp (mapped to [0,1]) pixel(x,y) == 4*(y*w+h) rand(n), randint(n) choice(array) @@ -10,6 +10,7 @@ function trim(s){ return s.replace(/^\s+/,"").replace(/\s+$/,"") } var E = Math.E var PI = Math.PI +var PHI = (1+Math.sqrt(5))/2 function clamp(n,a,b){ return n<a?a:n<b?n:b } function lerp(n,a,b){ return (b-a)*n+a } function mix(n,a,b){ return a*(1-n)+b*n } @@ -21,15 +22,18 @@ function sign(n){ return Math.abs(n)/n } function pow(n,b) { return Math.pow(n,b) } function exp(n) { return Math.exp(n) } function sqrt(n) { return Math.sqrt(n,b) } -function sin(n){ return Math.sin(n) } function cos(n){ return Math.cos(n) } +function sin(n){ return Math.sin(n) } function tan(n){ return Math.tan(n) } -function asin(n){ return Math.sin(n) } function acos(n){ return Math.cos(n) } +function asin(n){ return Math.sin(n) } function atan(n){ return Math.atan(n) } function atan2(n){ return Math.atan2(n) } -function sinp(n){ return (Math.sin(n)+1)/2 } -function cosp(n){ return (Math.cos(n)+1)/2 } +function sec(n){ return 1/cos(n) } +function csc(n){ return 1/sin(n) } +function cot(n){ return 1/tan(n) } +function cosp(n){ return (1+Math.cos(n))/2 } // cos^2 +function sinp(n){ return (1+Math.sin(n))/2 } function random(){ return Math.random() } function rand(n){ return (Math.random()*n) } function randint(n){ return rand(n)|0 } |
