-
Trigonometry
How does the trigonometry in this function work?? Math.cosD() and Math.sinD() are custom functions that return angles in degrees. Vector is a class with x and y properties.
Vector.prototype.rotate=function(angle){
var ca=Math.cosD(angle);
var sa=Math.sinD(angle);
with(this){
var rx=x*ca-y*sa;
var ry=x*sa+y*ca;
x=rx;
y=ry;
}
};
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|