Pages: [1]   Go Down
Author Topic: Help calculating xyz-coordinates of a 2nd. point of a line in 3D  (Read 375 times)
0 Members and 1 Guest are viewing this topic.
Venezuela
Offline Offline
God Member
*****
Karma: 17
Posts: 523
Ground, ground, always ground
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Oregon, USA
Offline Offline
Edison Member
*
Karma: 72
Posts: 2482
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: October 23, 2013, 01:02:42 pm by jremington » Logged

"It seems to run on some form of electricity"

Venezuela
Offline Offline
God Member
*****
Karma: 17
Posts: 523
Ground, ground, always ground
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!

Logged

Oregon, USA
Offline Offline
Edison Member
*
Karma: 72
Posts: 2482
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

"It seems to run on some form of electricity"

Pages: [1]   Go Up
Jump to: