#### Archived

This topic is now archived and is closed to further replies.

# 3D maths, finding x,y,z from angles/axis rotation

This topic is 5304 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

You know in 2D how you can work out the x,y from the angle and distance . That is what I want to do in 3d. But there are a few little things that I am confused about. First to get the angle of the 3 different axises, is it like this?: x axis = using z and y planes to calculate? y axis = using z and x planes to calculate? z axis = using x and y planes to calculate? if so, can I work out the x point from either the calculations of the y or z axis and so on for the y and z points ? Thanks, [edited by - johnnyBravo on January 6, 2004 2:08:48 AM]

##### Share on other sites
In 2D, from a yaw angle and a distance you can calculate X and Y. This is basically a conversion from polar coordinates to Cartesian coordinates.

In 3D, you have two angles and a distance - these two angles are yaw and pitch - that define an (X,Y,Z) point. Yaw is the same as it was in 2D. But pitch is the "upward" angle into the Z dimension that didn't exist in 2D.

First, use the XY planes to define a 2D coordinate system, and use the yaw angle to generate X and Y values (same math you used in 2D). For the pitch, use the XZ plane as a 2D coordinate system, and use the same math you did to find the X and Y coordinates before. But this time around, the Y value you find is really the Z value. So you have the X and Y coordinates you find with the yaw, and the Z coordinate you find with the pitch. Make this into a vector, normalize it, and multiply by the distance. You now have the point you want.

[edited by - Zipster on January 6, 2004 5:18:02 AM]

##### Share on other sites
k, but theres ''roll'' aswell isnt there?

##### Share on other sites
You can either use roll or pitch, as both will help you describe some sort of elevation above the XY plane. But it doesn''t matter, you only need two angles.

##### Share on other sites
It depends what you''re doing. If you''re trying to find a 3D vector from given angles, then you only need the 2 angles like he said. (and distance obviously)

If you''re working with a camera or object then roll might be used too, though it''s not usually.

1. 1
Rutin
26
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 10
• 9
• 9
• 9
• 46
• ### Forum Statistics

• Total Topics
631751
• Total Posts
3002077
×