natikos
natikos

Reputation: 111

Rotating vector by an angle and by given direction vector of the axis and there is a point of the axis. (3 dimensions)

  1. The 3D coordinates of the vector.

  2. The rotation angle in radians.

  3. The 3D coordinates of a point of the axis.

  4. The 3D coordinates of the direction vector of the axis.

The length of the direction vector is greater than 1e-8.

how I should rotate input vector?

First of all, I need to move my coordinate system into another start point? I don't understand how I should rotate my vector around a direction one. And then.. I should rotate at first around x axis, then y, and then z?

Upvotes: 0

Views: 1239

Answers (1)

MBo
MBo

Reputation: 80177

There is effective approach - using Rodrigues formula

To rotate vector V about axis with unit direction vector k by angle theta:

Vrot = V * cos(theta) + (k x v) * sin(theta) + k * (k.dot.v) * (1 - cos(theta))

Upvotes: 0

Related Questions