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.
It just uses the standard formulae for rotating a point about the origin by an amount of "angle" degrees.
the formulas that actually do the rotating are the
var rx=x*ca-y*sa; and
bits. Then it changes the old (x,y) of the vector to the new rotated ones. Did you want proof of the formula?
Click Here to Expand Forum to Full Width