Getting a 3d linear equation knowing the rotation of an object

415 Views Asked by At

I have an object, a simple rectangle

I rotate it by a certain degree using Euler Angles, in this case around Z, to make it easy lets say it's 45 degrees.

Right now I want the yellow: Y-Axis linear equation so looking at the world axes and knowing I rotated it 45 degrees clockwise:

http://s23.postimg.org/61ivhzvzv/rect1_rot1_Z45_2.png

I use the $b = tan(rZ = 45)$ to get the equation $ay + bx + c$ where $a$ equals $1$ (I only need the dependency between $y$ and $x$ so I can just say that $a$ equals $1$), $b$ would equal $1$ in this case.

And so now I rotate the rectangle around its local blue X-Axis, again 45 degrees:

http://s10.postimg.org/w8fxpda09/rect1_rot2_Y45.png

And I need the 3d linear equation for the yellow Y-Axis, $ay + bx + cz + d$. Just like in the previous equation I can just state that one of the variables equals $1$. Any ideas?

1

There are 1 best solutions below

6
On

For two points $p_1$ and $p_2$, a possible form of an equation of line that passes through them is

$$f(t) = t \cdot p_1 + (1-t) \cdot p_2. \tag{$\spadesuit$}$$

The only thing that matters is that $p_1 \neq p_2$, so put your two points where you want them (to form the yellow line) and rotate them together with the rectangle, just like any other points, $\spadesuit$ will still describe the line you are looking for.

I hope this helps ;-)