# Math Help - A Little 3D Maths...

1. ## A Little 3D Maths...

Not really sure if this is the correct forum to help, but i'm having a couple a problems with 3d co-ordinates.

I am working on a project to visualise some data. I am being supplied with vectors of data (a magnitude (-9999 to 9999) plus an axis reading 0-180 degrees). I am trying to made a 3d visualisation of this.
I have the start coordinates of each vector (x y z), and the 2D information(magnitude, and direction in the 2D plane), but don't have a clue how to calculate the 3D vector for each point from this information. any ideas or links to information on this sort of thing?

2. ## Just an update

i am now working on the assumption that i can calculate a vector which is on the same plane as the 2d point, calculate the equation of the plane, and then put the point hat i need in 3d into this equation to get the cartesian co-ordinates. Does this sound correct (or at least feasible).
If so can somebody suggest how i can get the plane normal from a vector and a point on the plane, as i cannot quit understand that much yet...

3. Originally Posted by kevd
i am now working on the assumption that i can calculate a vector which is on the same plane as the 2d point, calculate the equation of the plane, and then put the point hat i need in 3d into this equation to get the cartesian co-ordinates. Does this sound correct (or at least feasible).
If so can somebody suggest how i can get the plane normal from a vector and a point on the plane, as i cannot quit understand that much yet...
I'm not following why and how you're switching between 2D and 3D. But I can tell you how to get a normal to a plane using the cross product.

If you have trouble understanding that, then post an example so that I or others here can understand what notation you're using. Then we can translate to that notation. By notation, I mean do you use the $\mathbf{v} = 2\mathbf{i} + \mathbf{j} + 3\mathbf{k}$ notation for vectors, or the cartesian coordinates $\mathbf{v} = [2,1,3]$ or something else?

4. I am working on a project to visualise in a 3d manner stress in pipe. I am being provided with a stress vector (containing 2D polar coordinates, being the magnitude (-9999 to 9999) and and direction (0 to 180 degrees)). I am taking this data and mapping it onto a 3D visualisation i am about to create.

I will know the location of the centre of the pipe, A, (say (0,0,0)) and the location of the data point where the vector is to be mapped to, B (say (0,1,0) for sake of argument). From this, i'm hoping i can use the vector AB, to calculate the normal to the plane, and hence the equation of the plane.

And Thats where i need a way to get the 2d polar co-ordinates specified on that plane, to 3D so i can map the direction on the visualisation (maybe by using the equation of the plane and the one 3D point i already know on the plane, the Z co-ordinate of the second point may be obtainable), but this is where i need the help.

If my assumprions are way off please say, as i only was only given this information/project yesterday, and am only now beginning to look into how to achieve it.

5. Originally Posted by kevd
I am working on a project to visualise in a 3d manner stress in pipe. I am being provided with a stress vector (containing 2D polar coordinates, being the magnitude (-9999 to 9999) and and direction (0 to 180 degrees)). I am taking this data and mapping it onto a 3D visualisation i am about to create.

I will know the location of the centre of the pipe, A, (say (0,0,0)) and the location of the data point where the vector is to be mapped to, B (say (0,1,0) for sake of argument). From this, i'm hoping i can use the vector AB, to calculate the normal to the plane, and hence the equation of the plane.

And Thats where i need a way to get the 2d polar co-ordinates specified on that plane, to 3D so i can map the direction on the visualisation (maybe by using the equation of the plane and the one 3D point i already know on the plane, the Z co-ordinate of the second point may be obtainable), but this is where i need the help.

If my assumprions are way off please say, as i only was only given this information/project yesterday, and am only now beginning to look into how to achieve it.
I'm still not sure what you mean, but I'll try to state my interpretation so far.

Start with the pipe on the (x,y) plane. It lies along the x-axis starting at the origin. Let the direction of the pipe be denoted by the unit vector along the x-axis. In 3D coordinates this direction vector is (1,0,0). The stress vector translated to cartesian coordinates in the (x,y) plane is (s,t). The 3D coordinates are (s,t,0). The 3D unit normal to the (x,y) plane at the origin is just the unit vector (0,0,1) along the z-axis.

Now suppose we rotate the plane, the pipe, the stress vector and the unit normal vector all together in 3D space. We want to know what are the coordinates of the pipe, stress and unit normal vectors after the rotation.

We can represent the rotation with a matrix (see here and here)

where the angles $(\alpha,\beta,\gamma)$ are the angles of rotation, called the Euler angles. Then the rotated coordinates of the pipe, stress and unit normal vectors will just be their original coordinates multiplied by this matrix.

Postponing the question of how to calculate the Euler angles, is this anywhere near what you had in mind?

6. cheers,
Its definately given me somewhere to start. I'll probably be back posting when i get stuck again(or atl east when my head stops spinning from the confusion), but it seems to be exactly what i needed, and it even makes sense!

7. thanks Jake,

I'm sure you can guess the question thats coming now, but here goes. Euler angles.. i think i now understand the concept, but cannot get my head round how to calculate them for a given rotation. Could you possilbly explain using the following example?

the vector on x,y plane is (3,2,0), lets say i wanted to rotate everythin by 30 degrees on the x-axis, 20 degrees on the y-axis, and 45 degrees on the z-axis

Sorry if i'm missing something simple, but i'm new to eulers angles etc.

8. Originally Posted by kevd
thanks Jake,

I'm sure you can guess the question thats coming now, but here goes. Euler angles.. i think i now understand the concept, but cannot get my head round how to calculate them for a given rotation. Could you possilbly explain using the following example?

the vector on x,y plane is (3,2,0), lets say i wanted to rotate everythin by 30 degrees on the x-axis, 20 degrees on the y-axis, and 45 degrees on the z-axis

Sorry if i'm missing something simple, but i'm new to eulers angles etc.
You're not missing something simple. This is complicated stuff.

I'm new to this too. I liked your question because it gave me a chance to better understand what I had run across before. But after reading more links on the web and playing with a computer program I wrote, my conclusion is I don't really get it and I don't think it simple enough to be described on the web. The questions you and I are both asking have been asked before and simple answers just aren't there. It seems reading books and/or taking classes are required.

So I'm bailing out here. Framing the problem and pointing to a few links I think you need to understand to do 3D is about as far as I can go. Good luck!

9. thanks anyway. I'm sure i'll work it out (sooner or later)

10. Originally Posted by kevd
thanks Jake,

I'm sure you can guess the question thats coming now, but here goes. Euler angles.. i think i now understand the concept, but cannot get my head round how to calculate them for a given rotation. Could you possilbly explain using the following example?

the vector on x,y plane is (3,2,0), lets say i wanted to rotate everythin by 30 degrees on the x-axis, 20 degrees on the y-axis, and 45 degrees on the z-axis

Sorry if i'm missing something simple, but i'm new to eulers angles etc.
kevd, while I bailed on trying to explain this question to you, I continued to work on understanding the problem. I found out a few things that explain the confusion I had and may help you.

First off, the angles you are describing are strictly speaking not Euler angles. They are the roll, pitch and yaw angles. From this Wikipedia page:

• To add to the confusion, flight and aerospace engineers, when using yaw, pitch, and roll ... to refer to rotations about the z, y, x axes, respectively, often call these the Euler angles. These x-y-z angles are properly known as the Tait-Bryan angles...

This page gives to a cookbook I could follow to compute the rotation matrix for the rotation you describe. You just calculate separate rotation matrices for each of the 3 axes and multiply them together. It seems simple enough except for notice some things:

• The angles are called Euler angles.
• The meanings of roll and pitch are switched from above.
• A positive rotation angle means clockwise when viewing an axis from the positive numbers to the origin. The author actually doesn't say which direction you are viewing the axis from; I found it is from the positive side by trying it out.
• The order the rotations are applied matters. The order used there is y, then x, then z. Use a different order and the effect is different.

So these roll-pitch-yaw angles seem straightforward if you are careful about the definitions. I still don't know how these relate to Euler angles and why you would use those.

All I can say is, what a stinking mess!

11. lol, cheers jake, think i'm closer to getting something working now! i'll post here if i do just to satify your curiosity!
Thanks for all the help,
Kev