Get direction vector of a line from a point and its rotation.

181 Views Asked by At

The title pretty much says what I need. Some details about my problem:

  • I have a cylinder.
  • I have a point outside this cylinder.
  • I want to find the direction from said point to the line that passes right through the middle of the cylinder. For that, I need the equation of said line.
  • I only have the coordinates for the middle point of the line and it's rotation relative to the world axis.
1

There are 1 best solutions below

8
On BEST ANSWER

It is unclear what your description of the geometry is. I assume that you start with a cylinder at origin, pointing along say $\hat z$ axis. You then rotate the cylinder using some angles. You can write the rotation matrix $R$ using the description on wikipedia. Then the new direction will be $R\hat z$. You now move the center of the cylinder ro a position described by vector $\vec r_0$. The parametric equation of the line going along the axis of the cylinder is $$\vec r_{axis}=\vec r_0+\lambda R\hat z$$ with $\lambda \in \mathbb R$.

Now you have a point $\vec r$ somewhere in space, and you want to calculate the perpendicular from $\vec r$ to the line above. The answer can also be found online.