You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i was need to write a similar code as your one for converting angle to rectangular perimeter coordinate,
basicaly the same way but maybe use a bit less cpu due to there is no need for a /
(you still need divide but depending stuff can be precomputed, based on canvas size)
a,b,c are the 3 first corner points, p is perimeter, rp the ratio between p and 360, pp is the position on the perimeter
/* convert angle to rectangle perimeter coordinates */functionangle2rect(angle,sx,sy){while(angle<0)angle+=360;angle%=360;vara=sy,b=a+sx,c=b+sy,p=(sx+sy)*2,rp=p/360;varpp=parseInt(((angle*rp)+(sy/2))%p,10);if(pp<=a)return{x:0,y:sy-pp};if(pp<=b)return{y:0,x:pp-a};if(pp<=c)return{x:sx,y:pp-b};return{y:sy,x:sx-(pp-c)};}
hi dude, pretty nice tool !
i was need to write a similar code as your one for converting angle to rectangular perimeter coordinate,
basicaly the same way but maybe use a bit less cpu due to there is no need for a /
(you still need divide but depending stuff can be precomputed, based on canvas size)
a,b,c are the 3 first corner points, p is perimeter, rp the ratio between p and 360, pp is the position on the perimeter
http://jsfiddle.net/r043v/Z7Zg7/
The text was updated successfully, but these errors were encountered: