Answers for "Rotate Vector by an angle"

0

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);
};
Posted by: Guest on June-15-2021

Code answers related to "Rotate Vector by an angle"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language