I had the same exact problem and I reported it to the Java3D team. I was
later informed that the problem has been fixed and should be in the next
release of Java3D 1.1.2.
Weylin
Hua Cao wrote:
> Hi, everyone,
>
> I have a problem as follows. The snapshot of the code is
>
> ......
> Transform3D currentTF = new Transform3D();
> tg.getTransform(currentTF);
> // tg is an instance of TransformGroup
>
> Vector3d newVec = null;
>
> ... // other code for initializing newVec
> // e.g. newVec = new Vector3d(0.1d, 0.2d, 0.3d);
> // what I want to do is to set different scales for X,Y,Z
>
> System.out.println("Operand vector=" + newVec);
>
> Vector3d v3d = new Vector3d();
> currentTF.getScale(v3d); // read the current scale
>
> System.out.println("Old vector=" + v3d);
> v3d.add(newVec);
>
> Vector3d clampV3d = new Vector3d();
> clampV3d.clamp(0.01d, 1.0d, v3d); // set up min and max
> System.out.println("Result vector=" + clampV3d);
>
> currentTF.setScale(clampV3d);
> tg.setTransform(currentTF);
>
> The above code was executed many times.
>
> The problem I had is :
> About once in 6 times (randomly), the scale read in from the Transform3D
> is different from that was set last time. The 3 values for X, Y, and Z
> were somehow
> swapped as described below.
>
> Operand vector=(0.1, 0.0, 0.0)
> Old vector=(0.513342083279505, 0.3099999999999998, 0.3133420832795053)
> Result vector=(0.613342083279505, 0.3099999999999998,
> 0.3133420832795053)
>
> Operand vector=(0.1, 0.0, 0.0)
> Old vector=(0.613342083279505, 0.3099999999999998, 0.3133420832795053)
> //my comments. This time the vector3d is the same as expected
> Result vector=(0.713342083279505, 0.3099999999999998,
> 0.3133420832795053)
>
> Operand vector=(0.1, 0.0, 0.0)
> Old vector=(0.3133420832795053, 0.7133420832795052, 0.30999999999999983)
> //my comments, this time it is not correct. The values were swapped.
> Result vector=(0.8133420832795052, 0.30999999999999983,
> 0.3133420832795053)
>
> ========
> This error can be reproduced.
> As I can see, the TransformGroup.setTransform() method was not
> performing consistently. I wonder if this is a bug?
> Did anyone see this before?
>
> Thanks.
>
> Hua Cao
>
> --
> Hua Cao
> =====================================================================
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 3D Home Page: http://java.sun.com/products/java-media/3D/
begin:vcard
adr;dom:;;;Dallas;TX;75234;
n:Debetaz;Weylin
x-mozilla-html:FALSE
org:i2 Technologies
version:2.1
email;internet:[EMAIL PROTECTED]
title:Software Engineer
tel;fax:(214) 860-6067
tel;work:(214) 515-3789
x-mozilla-cpt:;0
fn:Weylin Debetaz
end:vcard