1. 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.

2. 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

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

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

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

$\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

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

$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:

$\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:

$\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 $z=0.$ Plugging this back in, we see that $x+y=0,$ or $x=-y.$ Setting $t=y$ as our parameter, we can represent the equation of the line as

$\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

$\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?

3. Most of it, but where does $\mathbf{r}(t)=t\begin{bmatrix}-1\\1\\0\end{bmatrix}.$ come from?

4. It comes from the general equation of a line in 3D. You have

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

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

Make sense?

5. the procedure yes i think so...but will take a bit of going over.

6. Ok. Let me know if you have more questions.

7. So once I have the two vectors, they go into

$\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 but with what you've shown me so far i hope i can muddle through. Thanks again for all your help.

8. 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.

9. 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...

10. 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 $\mathbf{A}$, $\mathbf{B}$, $\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:

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

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

3. The cross product $\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?

11. 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.

12. So you're starting with known surface normals, and then rotating them about known axes through a known number of degrees?

13. exactly. Im taking 0,1,0 and rotating it by 45^ in R_z and 45^ in R_x and 0^ in R_y.

14. So you're doing the $R_{z}$ rotation first, and then the $R_{x}$ rotation? And no $R_{y}$ rotation?

15. correct, no $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

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

or

$R_{z} * R_{x} * R_{y}$ for euler angles.

Page 2 of 3 First 123 Last