Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-15-2008, 04:38 PM
Member
 
Join Date: Apr 2008
Posts: 1
elberral is on a distinguished road
Rotations and traslations in java3d
Hi!
I am making the project of race aim, using for the Java3D design.
It consists of simulating the movement of fish according to different behaviors.
I have a problem at the time of making diverse rotations and transferings followed, on transformGroup modified.
Here this the code of a testing program:

*********************

Universal SimpleUniver = new SimpleUniver (canvas3d);
Fish fish = new Fish ();
fish.imagPez = pez.creaPez ();
universo.getViewingPlatform () .setNominalViewingTransform ();
pez.TrasladaPez (new Vector3f (0.3f, 0.5f, 0.0f), (float) (Math.PI));
universo.addBranchGraph (fish.imagPez);
pez.TrasladaPez (new Vector3f (- 0.5f, - 0.5f, 0.0f), (float) (Math.PI/2));
universo.addBranchGraph (fish.imagPez);


//Here the call to TrasladaPez
public void TrasladaPez (Vector3f time, float angle) {

Transform3D to rotate = new Transform3D();
rotar.rotZ (angle);
rotar.setTranslation (time);
System.out.println (to rotate);
TransformGroup rotarGrupo = new TransformGroup (to rotate);
rotarGrupo.getTransform (to rotate);
rotarGrupo.setCapability (TransformGroup.ALLOW_TRANSFORM_WRITE);
rotarGrupo.setCapability (TransformGroup.ALLOW_TRANSFORM_READ);
this.imagPez.detach ();
Node node =this.imagPez.getChild (1);
this.imagPez.removeChild (1);
rotarGrupo.addChild (node);
this.imagPez.addChild (rotarGrupo);

}

********************



Basically what I do in this testing program is to make a call to the TrasladaPez function (), with parameters the vector on which is going away to make the transfering and the angle on which it is wanted to rotate this.

Then, the first call does well,
pez.TrasladaPez (new Vector3f (0.3f, 0.5f, 0.0f), (float) (Math.PI));

But in the second call the fish makes a movement undesired:
pez.TrasladaPez (new Vector3f (- 0.5f, - 0.5f, 0.0f), (float) ( Math.PI/2));
It is as if all the single screen instead of the fish was rotated, the problem has to be when applying the rotation, since when happening like east parameter code:

pez.TrasladaPez (new Vector3f (- 0.5f, - 0.5f, 0.0f), (float)(0.0));
The fish moves well.

So that something is understood better associate some screens with the corresponding parameters:

(Without calls to TrasladaPez ())
Coord. (0,0, 0,0, 0,0);


(With a single call to TrasladaPez ())
pez.TrasladaPez (new Vector3f (0.3f, 0.5f, 0.0f), (float) (Math.PI));
Coord. (0,3, 0,5, 0,0);

(2 followed transformations, without modifying the angle in 2ª)
pez.TrasladaPez (new Vector3f (0.3f, 0.5f, 0.0f), (float) (Math.PI));
pez.TrasladaPez (new Vector3f (- 0.3f, - 0.8f, 0.0f), (float) (0.0));
Coord. (0,0, - 0,3, 0,0);



(2 followed transformations, modifying the angle in 2ª)
pez.TrasladaPez (new Vector3f (0.3f, 0.5f, 0.0f), (float) (Math.PI));
pez.TrasladaPez (new Vector3f (- 0.3f, - 0.8f, 0.0f), (float) (Math.PI/2));
Coord. approx (- 0,4, - 0,4, 0,0);
Coord. Deberian to be: Coord. (0,0, - 0,3, 0,0);

Not is possible insert images.
If somebody can help me, i send him the screens to understand well my problem.

Thanks!
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java3D: Clicking and getting coordinates? seabhcan Advanced Java 0 01-11-2008 03:46 PM


All times are GMT +3. The time now is 07:27 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org