« Return to Thread: [Breaking Change] DO3D has new props localRotationX / Y /Z , pitch, yaw, roll are methods again

Re: [Breaking Change] DO3D has new propslocalRotationX/ Y /Z , pitch, yaw, roll are methods again

by Tim Knip-2 :: Rate this Message:

Reply to Author | View in Thread

Hi all,

The NaN issue is fixed I beleive, update is in repo.

Now... the issue of #rotationY only going from -90 / +90...

This has to do with the fact that #rotationX / Y / Z are Euler-angles.
A problem is that when one does pitch(), yaw() or roll() the above
props are getting updated thru Matrix3D#matrix2euler.

Now: the process to convert a matrix into Euler-angles is called
'factoring'. This process has one BIG disadvantage: the
'factorization' can yield TWO possible solutions (Different sets of
eulers can descibe the same rotation).

Bottomline is that yaw()-ing past rotationY = +/- 90 will make
#rotationX / Z 180...
Note that this behaviour only occurs with yaw(), pitch() and roll() =>
only these will trigger matrix2euler()

Don't see a solution for this (think its just the nature of
euler-angles)... anyone?

Tim

2008/7/23 John Grden <neoriley@...>:

> yeah I'm sure tim will likely get back to you - he's been working on this
> pretty vigorously as of late
>
> Thanks for the posts guys, this does help!
>
> On Wed, Jul 23, 2008 at 3:21 PM, Paul Tondeur <paul@...> wrote:
>>
>> Hi Jon,
>>
>> Thanks for the suggestions to solve this problem! Unfortunately, none of
>> these seems to work out correctly.
>> I tried using the code for this method from revision 647. This seems to
>> work without any problems right now. However I expect that this might
>> introduce some new problems as well.
>>
>> It might be an idea that someone from the pv3d team looks into this and
>> put this in the next update?
>> As soon as I've found a way to update the current implemented code I'll
>> post a new message.
>>
>> Paul
>>
>>
>> -----Original Message-----
>> From: papervision3d-bounces@...
>> [mailto:papervision3d-bounces@...] On Behalf Of Jon Bradley
>> Sent: woensdag 23 juli 2008 19:04
>> To: papervision3d@...
>> Subject: Re: [Papervision3D] [Breaking Change] DO3D has new
>> propslocalRotationX/ Y /Z , pitch, yaw, roll are methods again
>>
>> Ah, I'm a doofus. Didn't put in the matrix props correctly. This
>> method is completely untested.
>>
>>        public static function matrix2euler( m :Matrix3D,
>> euler:Number3D=null, scale:Number3D=null ) : Number3D
>>        {
>>                euler = euler || new Number3D();
>>
>>         var x:Number = 0;
>>         var y:Number = 0;
>>         var c:Number = 0;
>>
>>         euler.y = -Math.asin( m.n13);
>>         c = Math.cos(ay);
>>
>>         if ( Math.abs(c) > 0.005 )
>>         {
>>             x =  m.n33/c;
>>             y = -m.n23/c;
>>
>>             euler.x = Math.atan2(y,x);
>>
>>             x = m.n11/c;
>>             y = m.n12/c;
>>
>>             euler.z = atan2(y,x);
>>         }
>>         else
>>         {
>>             euler.x = 0;
>>             x = m.n22;
>>             y = m.n21;
>>             euler.z = atan2(y,x);
>>         }
>>
>>         //  Clamp values
>>         euler.x = (euler.x > 360) ? 360:((euler.x < 0) ? 0:euler.x);
>>         euler.y = (euler.y > 360) ? 360:((euler.y < 0) ? 0:euler.y);
>>         euler.z = (euler.z > 360) ? 360:((euler.z < 0) ? 0:euler.z);
>>
>>                if(Papervision3D.useDEGREES)
>>                {
>>                        euler.x *= toDEGREES;
>>                        euler.y *= toDEGREES;
>>                        euler.z *= toDEGREES;
>>                }
>>
>>                return euler;
>>     }
>>
>>
>>
>>
>> _______________________________________________
>> Papervision3D mailing list
>> Papervision3D@...
>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>
>> _______________________________________________
>> Papervision3D mailing list
>> Papervision3D@...
>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
> --
> [ JPG ]
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>

_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

 « Return to Thread: [Breaking Change] DO3D has new props localRotationX / Y /Z , pitch, yaw, roll are methods again