Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Rotate Vector by an angle

var rotateVector = function(vec, ang)
{
    ang = -ang * (Math.PI/180);
    var cos = Math.cos(ang);
    var sin = Math.sin(ang);
    return new Array(Math.round(10000*(vec[0] * cos - vec[1] * sin))/10000, Math.round(10000*(vec[0] * sin + vec[1] * cos))/10000);
};
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Rotate #Vector #angle
ADD COMMENT
Topic
Name
2+3 =