Tina,
You are still applying scaling and transforming to the same
TransformGroup.
I'll defer to someone else with more experience (and available time -
I'd hate to quick hack out an answer and get something wrong) with
matrices to explain the subtle differences in what you are asking to be
clarified.
- John Wright
Starfire Research
Tina Manoharan Valappil wrote:
>
> Hi John,
>
> I have changed my scenegraph like you said so now it looks like
> below. But it is still now working. I am attaching two images
> showing before scaling (1.0, 1.0, 1.0) and after scaling to
> (0.3, 0.3, 0.3).
>
> > > This is my scenegraph:
> > > --------------------------------------------------------------
> > >
> > > <SimpleUniverse> - <VPTrans/Avatar start point (0.0, 0.5, 3.0)>
> > > |
> > > <worldBG>
> > > |
> > > <worldTG> this is the world start point (0.0, 0.0, 0.0)
> > > | for navigation
> > > <pickBG>
> > > |
> > > <objBG> detachable, under which I have my loaded VRML obj
> > > |
> > > <objTG> inserted 1 unit in front of the Avatar
> | for picking obj
> <scaleTG> all scaling is done to this TG
> > > |
> > > <BG> Bg from loading e.g. scene.getSceneGroup()
> > > |
> > > <VRML loaded obj>
> > >
> > > Then when the user inputs scale value say (0.3, 0.3, 0.3)
> > > I am applying the scale like this:
> > > ----------------------------------------------------------
> Vector3d scaleVector = new Vector3d(xScale, yScale, zScale);
>
> Transform3D scaleTrans = new Transform3D();
>
> scaleTG.getTransform(scaleTrans);
>
> scaleTrans.setScale(scaleVector);
>
> scaleTG.setTransform(scaleTrans);
>
> But then the object is still translating. I also tried
> translating the object to (0,0,0) and then scale and then
> translating back to original(x, y, z) but that puts the object
> somewhere else even though when I print the matrix values they
> seem to be right.
>
> Please can you also clear this for me .. What is the difference
> if I do it like
>
> 1. Transform3D t1 = new Transform3d();
> t1.setTranslation(new Vector(0,0,0));
>
> Transform3D s = new Transform3d();
> s.setScale(new Vector3d(1.0, 2.0, 3.0));
>
> Transform3D t2 = new Transform3D();
> t2.setTranslation(originalPosition);
>
> final = [original] * [t1] * [s] * [t2];
>
> 2. original.setTranslation(new Vector(0,0,0));
> original.setScale(new Vector3d(1.0, 2.0, 3.0));
> original.setTranslation(originalPosition);
>
> What is the difference??I can see that when I print the matrix
> values they both generate them differently but still it is not
> like the transformations that I learnt in school !!
>
> Thanks for your help.
> Tina
>
> ------------------------------------------------------------------------
> [Image] [Image]
===========================================================================
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".