Answer the question
In order to leave comments, you need to log in
How to rotate a vector without error?
There are the following elements:
Vector
Coordinate rotation functiona = {x: 1, y: 0}
function rotate(angle) {
a.x = a.x * Math.cos(angle) - a.y * Math.sin(angle);
a.y = a.x * Math.sin(angle) + a.y * Math.cos(angle);
}
rotate(1 * Math.PI / 180);
Math.sqrt( Math.pow(a.x, 2) + Math.pow(a.y, 2) )
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question