Convert quaternion to a line equation

690 Views Asked by At

I have a following set of data:

  • Plane equation
  • Camera position give an $x$, $y$, $z$
  • Camera rotation given as a quaternion

I need to find an intersection of a line going straight ahead from the camera (like a line between current camera position and a point laying in the middle of the field of view is some distance from the camera) and a given plane. Intersection between a line and a plane is simple but how can I obtain an equation of such a line from a quaternion?

1

There are 1 best solutions below

0
On BEST ANSWER

You need to know which way the camera points in the absence of rotation. Say that the direction is ${\bf p}_0=(1,0,0)$. When you rotate this vector by quaternion ${\bf q}$, you get ${\bf p}={\bf q}{\bf p}_0{\bf q}^{-1}$ (from wikipedia) The equation of the line is then $(x,y,z)+t{\bf p}=(x,y,z)+t{\bf q}{\bf p}_0{\bf q}^{-1}$ with $t \in\mathbb R$.