Mercurial > hg > Game > WebGL
view dandy/resources/sankaku.js @ 1:54589bb5e57d
add dandy
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 23 Feb 2012 14:51:33 +0900 |
parents | |
children |
line wrap: on
line source
mycos = []; mysin = []; const SANKAKU = 100000; const pi2 = Math.PI * 2.0; function sankakuf() { for(var i=0; i < 180; i++){ mysin[i] = Math.sin(i / 360.0 * pi2) * SANKAKU; } for(i=0; i < 180; i++) { mycos[i] = Math.cos(i / 360.0 * pi2) * SANKAKU; } } function Mycos(c) { c = parseInt(c); c %= 360; if(c < 0) c += 360; if((c <= 180)) return (mycos[c]); if(c > 180) return (mycos[180 - (c - 180)]); return 0; } function Mysin(c) { c = parseInt(c); if(c < 1) c += 1; c %= 360; if( c < 0) c += 360; if(c <= 180) return (mysin[c]); if(c > 180) return (mysin[180 - (c - 180)] * -1); return 0; }