SimpleVector - Interactive examples

back

Rotation methods

The rotation methods take as a parameter a number representing an angle. To let you test the methods taking an angle in radians, this page lets you input parameters as strings which are evaluated with eval().

This way you can use a number or a valid javascript expression like Math.PI/3 as you would in your code.

Then you can drag the vector to its initial position then click to see how the methods modify the vector.

v
x:2, y:0
v.rotateBy( )
v.rotateByDeg( )
v.rotateTo( )
v.rotateToDeg( )

v1
x:2, y:0
v2
x:0, y:4
v1.rotateTowards(v2, )
v.rotateTowardsDeg(v2, )