4
$\begingroup$

I have a 3D line vector with end points x0 and x1, which lies along the x-axis of a subsection of the plane, P.

However P has been translated, rotated and translated back from the global coordinate system by theta degrees along the global x-axis. The following image should illustrate my point.

enter image description here

I need to rotate my 3D line vector by a known angle theta to find the line between x0 and x2.

Can this be done by a set of transformation matrices (i.e. translate, x-rotate to global xy-plane, z-rotate by theta then x-rotate and translate back)?

If so, how do I do this? I know the 3D vector equation is as below, but I'm not sure how to integrate that into the transformation.

enter image description here

UPDATE:

Thanks for the answers guys. I apologise for not making myself clear - my head's got in a bit of a muddle with all this!

So I have a world system as in the 1st image, where the Z-axis faces vertically up. $P$, the red plane section, is defined by it's normal (giving orientation) and it's distance, $d$, from the origin using the equation $\textbf{n}\cdot\textbf{x} = d$

$\textbf{n}$ is formed using the rotation of the plane in terms of the global coordinate system. That is, assume that $P$ was flat along the x-y plane, as with the black one. It was translated to the origin, rotated by (e.g.) 25 degrees, then translated back.

The actual problem I'm trying to solve is to simulate an object moving from the first (black) plane onto the 2nd (red). I know the direction and speed of the object's movement on the black plane, but I need to know it on the red. I know $x_0$, this is the objects position at the intersection of the two planes. I can work out $x_1$ by simply taking the unit direction vector from one end of P to the other (call this $l$) and multiplying it by the object's speed: $x_1 = x_0 + s*l$

However, my object may not be moving directly up the plane as assumed for $l$. We know the angle it's moving at relative to $l$, call this $\theta$. I need to work out the new vector for that direction, so I can add some multiple of it to $x_0$.

  • 0
    You need a Given's rotation around the $x$-$z$ pane. See @ja72's answer below.2012-07-11

3 Answers 3

0

A systematic approach in the general case if you know the axis of rotation ( which is the normal to the plane it rotates in ), is to split it into three operations:

$\bf R_{3D} = {\bf T_R}^{-1} {\bf R} \bf T_R$

  1. $\bf T_R$ first moves us to a space where the last vector is the axis of rotation and the first two span the plane of rotation. In that space our $\bf R$ matrix would be a block matrix looking like this:

  2. With $\bf R_{2D}$ is a 2-dimensional rotation matrix:${\bf R} = \left[\begin{array}{cc}\bf R_{2D} & 0 \\ 0 & 1\end{array}\right]$

  3. Finally, after the rotation the ${\bf T_R}^{-1}$ takes us back to the original space.

0

Let the line segment from $x_0$ to $x_1$ have direction ratios $(a,b,c)$. Translate the setup by translating $x_0$ to the origin.

By the relation between inner product, norm, and angle between vectors we have

$\frac{ax+by+cz}{x^2+y^2+z^2}=\cos\phi$

But since we need to rotate and not scale, we have to get a norm 1 vector So here we go.

$ax+by+cz=\cos\phi$ and $x^2+y^2+z^2=1$

Solve this system and get a vector $v$ (make sure it's in $P$ by bringing in the equation of $P$!) of norm $1$.

Then your $x_2$ is just $x_0+v$

0

Is this what you want?

$\left(\begin{matrix} x \\ y \\ z \end{matrix}\right) = \left(\begin{matrix} 0 \\ a \\ 0 \end{matrix}\right) + \left(\begin{matrix} 0 \\ a\,(\cos(\theta)-1) \\ a\,\sin(\theta) \end{matrix}\right)\;t $

where $X_2$ lies on the $y$-axis a distance $a$ from $X_0$.

How?

A point on the line is defined by the origin

$\vec{X}_2 = \left(\begin{matrix} 0 \\ a \\ 0 \end{matrix}\right) $

and point

$\vec{X}_1 = {\rm Rx}(\theta) \vec{X}_2 $

to give the equation:

$\vec{r} = \vec{X}_2 + \left( {\rm Rx}(\theta) \vec{X}_2-\vec{X}_2 \right)\; t $

with

$ {\rm Rx}(\theta) = \left(\begin{matrix} 1 & 0 & 0 \\ 0 & \cos\theta & -\sin\theta \\ 0 & \sin\theta & \cos\theta \end{matrix}\right) $

  • 0
    Thanks for your help, this wasn't quite what I did in the end, but it did inspire it so I've marked it as the answer.2012-07-13