C ++: rotate a vector around a plane normal

I am trying to rotate a point on a plane around the normal of the plane with a certain angle (so it stays on the plane).

For instance:

  • Point = (0,0,1) (on the plane)
  • Normal = (0,1,0)
  • Angle = 33 degrees

But can't seem to do it

EDIT:

The axis of rotation always passes through the origin (0,0,0)

+4
source share
3 answers

If you are looking for rotations with an axis in three-dimensional space, Rodrigue's Rotation Formula is very useful. Wikipedia page is pretty good: here

+2
source

Probably not optimal, but: find the vectors of the span plane (name them U and V), express the point P in terms of U and V and apply two-dimensional rotation. PS: normal does not fully determine the plane; you need at least a point in the plane.

0
source

To calculate the required rotation matrix, you need a little linear algebra. There is a Wikipedia article explaining what you need to do.

0
source

Source: https://habr.com/ru/post/1402477/


All Articles