Go Down

### Topic: Help calculating xyz-coordinates of a 2nd. point of a line in 3D (Read 722 times)previous topic - next topic

#### Palliser

##### Oct 23, 2013, 07:23 pm
I am not sure if this is the right board for my question. I though also of the Processing board but not sure.

I am obtaining the x, y and z angular positions from a L3G4200D gyroscope with values between 0 and 359 degrees.
With that information, I am rotating a line about the origin in a 3D space (using Processing).

If I set the distance of the line to a value d, is it possible to calculate the x,y an z coordinates of the second point with only the 3 angles and the distance? If so, I'd really appreciate any help or reference about how to do it. Thank you.

#### jremington

#1
##### Oct 23, 2013, 07:58 pmLast Edit: Oct 23, 2013, 08:02 pm by jremington Reason: 1
Yes, you need to calculate the direction cosines for your choice of coordinate system. From the result and the distance d you can calculate the point relative to the origin. There are many discussions, here is one: http://user.gs.rmit.edu.au/rod/files/publications/PLANES.pdf?

#### Palliser

#2
##### Oct 25, 2013, 05:50 am
I just wanted to comment that my gyro angles are Euler angles. Thus, the following conversion formulas from Wikipedia didn't work.

Quote
x=r * sin(theta) * cos(phi)
y=r * sin(theta) * sin(phi)
z=r * cos(theta)

http://en.wikipedia.org/wiki/Spherical_coordinate_system#Cartesian_coordinates

I still don't know how to fit my Euler angles in the Euclidean space.  For my direct raw tests, I am using and Arduino with 3 pots mapped from 0 to 360. Regards!

#### jremington

#3
##### Oct 25, 2013, 08:37 am
Unfortunately, there is no unique definition for "Euler angles". Furthermore, there are ambiguities in certain combinations of the Euler angle rotations that lead to a problem known as "gimbal lock". In short, you can apply different sets of rotations that lead to the same object orientation, so there is no unique mapping from angles to 3D space. Without knowing the exact specifications for the various coordinate frames defined for your project, I don't  think it is possible to give more specific help.

Go Up

Please enter a valid email to subscribe