Rotates a vector about an axis, returning a new vector . The axis is defined by an axis vector . Positive angles rotate about the axis according to the Right-Hand Rule. This function will always return a unit vector . See also vectorAt() which is a simplified version of this function for 2D problems.
rotateVector ( base As Vector, _
angle As Number, _
axis As Vector ) As Vector
Argument | Type | Description |
---|---|---|
base | Vector | The vector to be rotated. |
angle | Number | Angle of rotation |
axis | Vector | The direction of the axis. |
Intent >rotateVector(UnitX, 90, UnitZ)
--> Vector_(0.0, 1.0, 0.0, WorldFrame())
Intent >rotateVector(UnitX, 30, -UnitY)
--> Vector_(0.86602540378444, 0.0, 0.5, WorldFrame())
Intent >rotateVector(vector(1,0,0), 45, vector(0,0,1))
--> Vector_(0.70710678118655, 0.70710678118655, 0.0, WorldFrame())
Intent >rotateVector(vector(1,0,0), 45, vector(1,0,0))
--> Vector_(1.0, 0.0, 0.0, WorldFrame())