A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by frankk » Mon Nov 03, 2008 7:36 pm
Hi,
it's me again but this time, I do not wanna ask you about the custommultibody vehicle.
I just wanna know a simple formula :
How to determine the main axis (direction) of a 3D body out of the matrix that newton gives us. This direction must also be relative to something, but how to calculate it ?
Thanks in advance for taking time to answer to this simple newbie 3D question.
-
frankk
-
- Posts: 32
- Joined: Thu Oct 09, 2008 2:40 pm
- Location: Quebec, Canada
by frankk » Tue Nov 04, 2008 11:02 am
In other words, how to get the yaw, pitch and roll ?
-
frankk
-
- Posts: 32
- Joined: Thu Oct 09, 2008 2:40 pm
- Location: Quebec, Canada
by Julio Jerez » Tue Nov 04, 2008 11:30 am
That depend, what do you need it for?
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by JernejL » Tue Nov 04, 2008 1:27 pm
Perhaps NewtonGetEulerAngle is what you need.
-
JernejL
-
- Posts: 1578
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by Dave Gravel » Tue Nov 04, 2008 10:35 pm
If you need it from the matrix you can do it like this.
I don't have test it with all situation but working good for me.
- Code: Select all
function GetMatrixTurnAngle(mat: Tmatrix): single;
begin
result :=radtodeg(-arctan2(-mat[2,0], mat[0,0]));
end;
function GetMatrixPitchAngle(mat: Tmatrix): single;
begin
result :=radtodeg(-arctan2(-mat[1,2], mat[1,1]));
end;
function GetMatrixRollAngle(mat: Tmatrix): single;
begin
result :=radtodeg(-arcsin(mat[1,0]));
end;
-
Dave Gravel
-
- Posts: 800
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 16 guests