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.

Printable View

- January 12th 2011, 07:21 AMconorc
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.

- January 12th 2011, 07:40 AMAckbeet
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

where is the angle between the two vectors.

3. Solve for as per the following:

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

and

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:

The equations these computations represent are as follows:

and hence we see immediately that Plugging this back in, we see that or Setting as our parameter, we can represent the equation of the line as

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

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? - January 12th 2011, 08:41 AMconorc
Most of it, but where does come from?

- January 12th 2011, 08:46 AMAckbeet
It comes from the general equation of a line in 3D. You have

where is a vector in the direction of the line, and is a point on the line. It's essentially the same thing as your . In this case, the since the line goes through the origin (plug in , and you'll see that).

Make sense? - January 12th 2011, 09:04 AMconorc
the procedure yes i think so...but will take a bit of going over.

- January 12th 2011, 09:34 AMAckbeet
Ok. Let me know if you have more questions.

- January 12th 2011, 09:46 AMconorc
So once I have the two vectors, they go into

(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. - January 12th 2011, 09:55 AMAckbeet
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.

- January 28th 2011, 02:28 AMconorc
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... - January 28th 2011, 03:34 AMAckbeet
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 , , . 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:

3. The cross product 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? - January 28th 2011, 03:48 AMconorc
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. - January 28th 2011, 05:38 AMAckbeet
So you're starting with known surface normals, and then rotating them about known axes through a known number of degrees?

- January 28th 2011, 06:23 AMconorc
exactly. Im taking 0,1,0 and rotating it by 45^ in R_z and 45^ in R_x and 0^ in R_y.

- January 28th 2011, 07:03 AMAckbeet
So you're doing the rotation first, and then the rotation? And no rotation?

- January 28th 2011, 07:06 AMconorc
correct, no 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

for pitch roll and yaw

or

for euler angles.