I am trying to create a cylinder in 3D space. I get a start and endpoint in 3D and to place the vertices, I need to create 2 circles for the bottom and the top of the cylinder. I thought about making a vector u with coordinates (1,0,0) and calculate a direction vector dir = end - start. Now I make the cross product to get a vector w = u x dir: this way I am 90 degrees away from the dir vector with w. The problem is, how do I calculate the next position w' with an arbitrary angle between w and w'. I Read a lot about rotation matrix, and that i can rotate around X-Axis with something like:
Rx(angle) =
(1 0 0 )
(0 cos(angle) -sin(angle))
(0 sin(angle) cos(angle) )
but the direction can be something like (1.442, -3.22, 7.23). So it isn't always the x-axis but maybe I need to rotate for every new w' in every axis. And I don't know how to figure out what angle I need to calculate, how to calculate and which angle belongs to witch rotation matrix.
See Question&Answers more detail:os