This should be added to J3d.org or the Java3D faq I believe.

Syrus Mesdaghi wrote:

> Hello Josh,
>
> I saw Kelvin's post regarding the "bug", but I'm not sure if you have found
> a work-around yet. If you haven't, you can try the following.
>
> I've dealt with this problem many times and it all comes down to how much
> error accumulates in the transform above the view. You may have noticed that
> the problem doesn't occur if you are using that transform to rotate an
> object (as apposed to the view). That's because the invert of the view
> matrix is applied to the whole scene and the Invert () method is probably
> introducing plenty of floating point miscalculation in the resulting matrix.
> I have tried many different ways and have gotten reasonable results but the
> following works pretty well:
>
> 1) Get the translation of the matrix/transform
>
> 2) Call say .rotX on the actual Matrix/transform that you will plug into the
> scene. As you may know, .rotX will wipe out any translation or previous
> rotation and give you a "clean" rotation. The only problem is that you have
> to keep track of current rotation in another local variable (see below)
>
> 3) Set the rotation back in the matrix.
>
>  /////////////////////////////////////////////////
>
> entityMat.get(translation);
> entityRotY += entityRotYRate * "some analog value if using mouse or ....";
> entityMat.rotY(entityRotY);
> entityMat.setTranslation(translation);
>
>  As apposed to:
>
> delta.rotY(entityRotYRate * "some analog value if using mouse or ....");
>
> entityMat.mul(delta);
>
> Keep in mind that if you are using an analog multiplier (say a number
> between -1 and 1), you should try to keep it as "clean" as possible. Instead
> of say 1.003432045, use 1.0, and -0.3 instead of -0.304090737. Try to use as
> few decimal places as possible. Multiplying two matrices can introduce
> floating-point miscalculations (as you may know it has plenty of multiplies
> in there; the Invert function is even worse).
>
> If your using some one else's behavior and you don't have the source and you
> don't ... :), you can catch the exception when plugging the transform in to
> the scene and try to "fix" the matrix. That is to be sure all rotation
> vectors are still normalized and are perpendicular to each other. If you can
> predict which vector is the most accurate, you can do a double-cross to
> "fix" it (similar to computing a lookAt matrix). If you had to do this, and
> needed help (especially if I'm not making much sense :) ), you can contact
> me.
>
>
>
> Take Care, SyrusM
>
> _______________________________________________
>
> Syrus Mesdaghi                Full Sail Real World Education
> Gaming Instructor             Winter Park, FL
> [EMAIL PROTECTED]       http://www.fullsail.com
> _______________________________________________
>
>
> ----- Original Message -----
> From: "Josh Richmond" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, March 26, 2001 9:13 PM
> Subject: Re: [JAVA3D] BadTransform bug in j3d1.2?
>
>
> I've attached two files. Run the app named BugViewer and rotate the view a
> little bit (hold the left mouse button down).
>
> The code affected is in ViewNavigator::orbit().
>
> Thanks for any help you can provide. If this is a bug sorry I wasn't able to
> report it until after Beta 2 was finished.
>
> josh
>
> ----------------------------------------------------
> Joshua L. Richmond, BASc, MSc.
> Systems Engineering (R&D)
>
> MD Robotics
> 9445 Airport Rd, Brampton, ON, Canada
> (905) 790-2800 x4332
> -----------------------------------------------------
>
>
>>>> Kelvin Chung <[EMAIL PROTECTED]> 03/26/01 05:07PM >>>
>>>
> Hi Josh,
>
>     Please give us a test program for investigation.
> It is most likely cause by numerical imprecision which
> accumulate over time big enough to make the transformation
> matrix not congruent. Try to use double instead of float
> to see if things get improves.
>
> It happen since v1.2.1 beta2 because Transform3D is
> enchanced to optimize for several matrix inversion cases
> and also in other case when the matrix is congruent.
>
> Thanks.
>
> - Kelvin
> ----------------
> Java 3D Team
> Sun Microsystems Inc.
>
>
>> Mime-Version: 1.0
>> Date: Mon, 26 Mar 2001 16:46:33 -0500
>> From: Josh Richmond <[EMAIL PROTECTED]>
>> Subject: [JAVA3D] BadTransform bug in j3d1.2?
>> To: [EMAIL PROTECTED]
>>
>> This is a poor excuse for a bug report because I'm not at a computer where
>
> I
> can run my code, nor do I have sample code (yet), but I thought I'd see if
> anyone else has witnessed this.
>
>> I'm using a slight variation of Eric's orbit behaviours. In version
>
> 1.2beta1,
> it works like a charm. In the release version of 1.2 I get a
> BadTransformException during rotations. This is very consistent and
> reproducible.
>
>> I plan on using the j3dutil Orbit behaviour, but thought I'd bring this up
>
> as
> it might point to a bigger problem.
>
>> Sample code can be made available.
>>
>> josh
>>
>> ----------------------------------------------------
>> Joshua L. Richmond, BASc, MSc.
>> Systems Engineering (R&D)
>>
>> MD Robotics
>> 9445 Airport Rd, Brampton, ON, Canada
>> (905) 790-2800 x4332
>> -----------------------------------------------------
>>
>
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".


--
___________________________________________________________

Shawn Kendall               Full Sail Real World Education
Course Director             3300 University BLVD
Real Time 3D for Gaming     Winter Park FL 32792
[EMAIL PROTECTED]       http://www.fullsail.com
___________________________________________________________

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to