What has changed with NewtonGetEulerAngle?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

What has changed with NewtonGetEulerAngle?

Postby pjay » Sun Sep 21, 2014 11:16 am

I've just migrated from Newton 2.24 to Newton 3.12 and I've noticed a change in behaviour with NewtonGetEulerAngle.

I've written a very simplistic & antiquated OpenGL renderer in Purebasic for the purposes of quickly prototyping ideas & it uses the Euler rotation angles for calculating shadow volumes. The trouble i'm having is that these angles are 'waving' about a bit in 3.12, causing the shadows being generated at incorrect angles, whereas it was behaving perfectly in 2.24.

What's the reasoning for NewtonGetEulerAngle now requiring two return pointers (*eulerangles0 / *eulerangles1?)

I've uploaded a small windows example which I hope shows this problem better than I've described it:
https://dl.dropboxusercontent.com/u/6000090/3%20-%20Basic%20Newton%20Dynamics%20-%20Spheres.zip)

Newton 2.24:
Image

Newton 3.12:
Image
pjay
 
Posts: 3
Joined: Sun Sep 21, 2014 5:47 am

Re: What has changed with NewtonGetEulerAngle?

Postby Julio Jerez » Sun Sep 21, 2014 11:37 am

first get Newton 3.13 from GitHub, is not longer the current archive
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: What has changed with NewtonGetEulerAngle?

Postby pjay » Sun Sep 21, 2014 12:46 pm

Thanks for the advice - I downloaded & compiled the latest source but the same behaviour is occurring.

I've updated the zip file with the 3.13 dll.
pjay
 
Posts: 3
Joined: Sun Sep 21, 2014 5:47 am

Re: What has changed with NewtonGetEulerAngle?

Postby Julio Jerez » Sun Sep 21, 2014 1:05 pm

the reason why no why function take two pointer to two euler angles is because
for each rotation matrix there are always two different set of eulers angle that yet the same rotation
now the function calculate both pairs?
you can always use the angle returned in the same vector.

can you tell me how are you using NewtonGetEulerAngles.
can you post the code fragment?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: What has changed with NewtonGetEulerAngle?

Postby pjay » Sun Sep 21, 2014 2:50 pm

I think I may have solved it. I compared the numbers that v2.24 & v3.13 were producing it highlighted that the Pitch and Roll were identical, but the Yaw was different (on the *Eulerangles0 numbers).

In the dgMatrix::CalcPitchYawRoll function, I made the following change:

From:
dgFloat32 yaw0 = -dgSin ( matrix[0][2]);
To:
dgFloat32 yaw0 = -dgAsin ( matrix[0][2]);

This now produces the same Yaw value as v2.24. I'm not sure if it's right or wrong, but it's working as I needed it to :D
pjay
 
Posts: 3
Joined: Sun Sep 21, 2014 5:47 am

Re: What has changed with NewtonGetEulerAngle?

Postby Julio Jerez » Sun Sep 21, 2014 3:14 pm

wow, that was a bad bug.
yes your fix is 100% correct.
I fixed and checked in it.

Please sync again
and thank you very much.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests