# Planar intersections

Show 40 post(s) from this thread on one page
Page 2 of 3 First 123 Last
• Jan 12th 2011, 06:21 AM
conorc
I didnt think of that, but i suppose it would be along the now tilted wall? So the angle would always be measured on the surface of whatever object the disc falls on.
• Jan 12th 2011, 06:40 AM
Ackbeet
In that case, what you might want to consider doing is a method that's more general: using dot products (could use cross products too, but dots involve slightly less computation).

Procedure:

1. Find the two vectors along the two lines that form the angle in which you're interested.
2. Compute the dot product "both ways"; that is, plug everything into the formula

$\displaystyle \mathbf{x}\cdot\mathbf{y}=|\mathbf{x}|\,|\mathbf{y }|\cos(\alpha),$

where $\displaystyle \alpha$ is the angle between the two vectors.

3. Solve for $\displaystyle \alpha$ as per the following:

$\displaystyle \displaystyle\alpha=\cos^{-1}\left(\frac{\mathbf{x}\cdot\mathbf{y}}{|\mathbf{ x}|\,|\mathbf{y}|}\right).$

Your step 1 here, in turn, will be composed of the steps of finding the equations for the planes whose intersection forms the lines, and then finding a vector that points in the direction of the line. Example:

Take the planes

$\displaystyle \dfrac{x}{2}+\dfrac{y}{2}+\dfrac{\sqrt{2}\,z}{2}=0$ and

$\displaystyle x+y-z=0.$

The first plane is the disc, you can see, and the second plane is just an arbitrary plane I chose. Now treat both these equations as simultaneous equations. You should be able to get it down to one arbitrary parameter that basically enables you to traverse the line. Solution:

$\displaystyle \begin{bmatrix}1 &1 &\sqrt{2}\\ 1 &1 &-1\end{bmatrix}\quad\to\quad \begin{bmatrix}1 &1 &\sqrt{2}\\ 0 &0 &\sqrt{2}+1\end{bmatrix}.$

The equations these computations represent are as follows:

$\displaystyle \begin{bmatrix}1 &1 &\sqrt{2}\\ 0 &0 &\sqrt{2}+1\end{bmatrix}\begin{bmatrix}x\\y\\z\end {bmatrix}=\begin{bmatrix}0\\0\end{bmatrix},$
and hence we see immediately that $\displaystyle z=0.$ Plugging this back in, we see that $\displaystyle x+y=0,$ or $\displaystyle x=-y.$ Setting $\displaystyle t=y$ as our parameter, we can represent the equation of the line as

$\displaystyle \mathbf{r}(t)=t\begin{bmatrix}-1\\1\\0\end{bmatrix}.$

Hence, a vector parallel to the line generated by the intersection of these two planes is given by

$\displaystyle \mathbf{r}(1)-\mathbf{r}(0)=\begin{bmatrix}-1\\1\\0\end{bmatrix}.$

Perform this same procedure with the intersection of the tilted wall and the ground, and you'll get another vector. This constitutes step 1.

Does all this make sense?
• Jan 12th 2011, 07:41 AM
conorc
Most of it, but where does $\displaystyle \mathbf{r}(t)=t\begin{bmatrix}-1\\1\\0\end{bmatrix}.$ come from?
• Jan 12th 2011, 07:46 AM
Ackbeet
It comes from the general equation of a line in 3D. You have

$\displaystyle \mathbf{r}(t)=t\mathbf{v}+\mathbf{b},$

where $\displaystyle \mathbf{v}$ is a vector in the direction of the line, and $\displaystyle \mathbf{b}$ is a point on the line. It's essentially the same thing as your $\displaystyle y=mx+b$. In this case, the $\displaystyle \mathbf{b}=0,$ since the line goes through the origin (plug in $\displaystyle t=0$, and you'll see that).

Make sense?
• Jan 12th 2011, 08:04 AM
conorc
the procedure yes i think so...but will take a bit of going over.
• Jan 12th 2011, 08:34 AM
Ackbeet
Ok. Let me know if you have more questions.
• Jan 12th 2011, 08:46 AM
conorc
So once I have the two vectors, they go into

$\displaystyle \displaystyle\alpha=\cos^{-1}\left(\frac{\mathbf{x}\cdot\mathbf{y}}{|\mathbf{ x}|\,|\mathbf{y}|}\right)$

(step 3 is just a reordered step 2?)

and that gives me alpha?

Im pretty sure ill get lost(Headbang) but with what you've shown me so far i hope i can muddle through. Thanks again for all your help.
• Jan 12th 2011, 08:55 AM
Ackbeet
Yeah, you could sort of combine steps 2 and 3 by just saying that you plug everything into the formula you just quoted. This will give you alpha. I should point out that alpha will be the acute angle between the two lines, because that's what the arccosine function gives you. Most of the time, that's probably adequate. But if you need the obtuse angle between two lines, you'll have to exploit the symmetries of the cosine function to find it.
• Jan 28th 2011, 01:28 AM
conorc
Ok, i think i have my head around most of it now, but now i find im falling at the first hurdle! Calculating the surface normals. I'm testing for other surfaces.

I had been using these for a three dimensional rotation.

Rotation matrix - Wikipedia, the free encyclopedia

To clarify, what i had been doing was, as it is a 3D rotation, substituting 45^ (or whatever angles I choose for a test) into two rotation matrices, depending on what two axis i am rotating around.

I then multiply Rx x Ry x Rz, as it mentions further down for matrix multiplication.

For the 45^ multiplication, I got

Code:

0.7071  -0.7071        0     0.5000    0.5000  -0.7071     0.5000    0.5000    0.7071

But now i think i should be doing it this way

Step 1: I take the three rotation matrices, and rotate them around different axes, by a set number of degrees. This means substituting 45^ for theta in each. I then multiply Rx by Ry by Rz. This gives me a 3 x 3 matrix, like i have above.

Step 2: I then take the surface normals of the plane before I rotated it, 1,0,0 for vertical, or 0,0,1 for horizontal, and multiply this 3x1 matrix by a 3x3, giving me a 3x1 matrix.

Im not sure if im right though...
• Jan 28th 2011, 02:34 AM
Ackbeet
If you have the equation of a plane, computing surface normals involves the following steps:

1. Compute the coordinates of three points in the plane that are NOT collinear. Call them $\displaystyle \mathbf{A}$, $\displaystyle \mathbf{B}$, $\displaystyle \mathbf{C}$. You can do this by simply plugging in whatever values you want for x and y, and then solving for the z's.
2. Form two linearly independent vectors as follows:

$\displaystyle \mathbf{P}=\mathbf{B}-\mathbf{A}$

$\displaystyle \mathbf{Q}=\mathbf{C}-\mathbf{A}.$

3. The cross product $\displaystyle \mathbf{P}\times\mathbf{Q}$ is a vector normal to the plane.

But, taking a step back here, refresh my memory a little: do you already have the equations for all the planes that you need? Or are taking a known plane and rotating it? Or how do you propose to get the equations for the plane?
• Jan 28th 2011, 02:48 AM
conorc
Hi Ackbeet:)

I know nothing except the degrees of rotation of the plane. From this im calculating the surface normals by using a the rotation matrices, and the starting orientation of the plane.
• Jan 28th 2011, 04:38 AM
Ackbeet
So you're starting with known surface normals, and then rotating them about known axes through a known number of degrees?
• Jan 28th 2011, 05:23 AM
conorc
exactly. Im taking 0,1,0 and rotating it by 45^ in R_z and 45^ in R_x and 0^ in R_y.
• Jan 28th 2011, 06:03 AM
Ackbeet
So you're doing the $\displaystyle R_{z}$ rotation first, and then the $\displaystyle R_{x}$ rotation? And no $\displaystyle R_{y}$ rotation?
• Jan 28th 2011, 06:06 AM
conorc
correct, no $\displaystyle R_{y}$ rotation.

Does it matter what order you do the other two in?

Just tested it, yes it certainly does...

The two orders off the rotation matrix page are

$\displaystyle R_{x} * R_{y} * R_{z}$ for pitch roll and yaw

or

$\displaystyle R_{z} * R_{x} * R_{y}$ for euler angles.
Show 40 post(s) from this thread on one page
Page 2 of 3 First 123 Last