Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (407)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Transform3D Questions  (Read 982 times)
0 Members and 1 Guest are viewing this topic.
Offline zparticle

Senior Member




Thick As A Brick


« Posted 2003-04-23 14:00:56 »

In the Transform3D class there are several methods that set a scale value. For instance the following:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
    /**
     * Sets the rotational component (upper 3x3) of this transform to the
     * values in the specified matrix. The other elements of this transform
     * are unchanged. An SVD (singular value decomposition) is performed
     * on this object's upper 3x3 matrix to factor out the scale, then this
     * objects upper 3x3 matrix components are replaced by the input
     * rotational components, and finally the scale is reapplied to the
     * rotational components.
     */


    public final void setRotation(Matrix3f m)


So what exactly is happening here? Is it the following steps:

1> Each element of the upper 3x3 matrix of the transform is being divided by the scale, and put back into the matrix.
2> Replace the elements in the upper 3x3 matrix with the new values from m.
3> Multiply the upper 3x3 matrix elements by the scale and replace the values.

If so what is the point of step number 1? If not then I'm obviously not understanding what SVD does and can someone explain it and/or show me some pseudo code?

Thanks.

Offline zparticle

Senior Member




Thick As A Brick


« Reply #1 - Posted 2003-04-23 14:30:40 »

Another question:

If you have:

1> TransformGroup that contains a rotational matrix defining 30 deg rotation around the X axis (Transform3D)
2> A child of 1 that is another TransformGroup containing a rotational matrix defining 15 deg rotation around the X axis (Transform3D)
3> A child of 2 that is another TransformGroup containing a translational matrix.

How would you get a single Transform3D that does the 45 deg rotation from the two matrices 1 & 2?

Do you multiply them together?

Do have to find all the transforms in the graph that are the same type, decompose them and add them together?

Offline zparticle

Senior Member




Thick As A Brick


« Reply #2 - Posted 2003-04-25 15:33:19 »

Do TransformGroup nodes effect everything below them in the scene graph?

Games published by our own members! Check 'em out!
Play the free demo of Revenge of the Titans!
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #3 - Posted 2003-04-25 15:48:47 »

hm, they leave all nodes below unchanged, but of course change their global positions.

But thats the trivial point in the scenegraph.

More important - they effect all nodes the way up to the root, bc. changing a transform is most likely to change the bounds of the parent nodes.

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #4 - Posted 2003-04-25 16:03:19 »

AFAIK, some scenegraph implementation have event systems for that, but something like

1  
2  
3  
4  
5  
TransformGroup#setTransform( Transform3D tx )
{
    mTx = tx;
    getParent().reComputeBounds();
}


might do the job as well.

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline zparticle

Senior Member




Thick As A Brick


« Reply #5 - Posted 2003-04-25 16:09:20 »

Okay so if I have:

if I have a BranchGroup containing TransformGroup A, that performs a translation and has TransformGroup B as a child. And B performs a rotation and has Shape3D children.

I should get:

no translation on B children and only rotation?


It seems that would make it very difficult to create a complicated object.


Another question:

I currently have it so the transform applies to everything under it in the graph. In the above example I'm getting a weird effect, the rotation works but the translation looks like it is causing a shear instead of a translate any idea what is causing that? I use the bottom row of the matrix for the translation which I think is correct. So it does a glMultMatrix for the translation and then another glMultMatrix for the rotation.

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #6 - Posted 2003-04-25 16:52:00 »

Quote
Okay so if I have:

if I have a BranchGroup containing TransformGroup A, that performs a translation and has TransformGroup B as a child. And B performs a rotation and has Shape3D children.

I should get:

no translation on B children and only rotation?


?? not sure. B has no translation with respect to A, but very well in the world. The shape is first translated, then rotated in the new position.


Quote

It seems that would make it very difficult to create a complicated object.


?? No, it is constructed that way to make complicated object simple! Having a spinning radar on a big ship e.g. - just spin the TransformGroup of the radar that is a child of the ship. The radar will travel anywhere the ship goes....


Quote

Another question:

I currently have it so the transform applies to everything under it in the graph. In the above example I'm getting a weird effect, the rotation works but the translation looks like it is causing a shear instead of a translate any idea what is causing that? I use the bottom row of the matrix for the translation which I think is correct. So it does a glMultMatrix for the translation and then another glMultMatrix for the rotation.


A 4x4 matrix can express a shear, so I assume you matrix construction has bugs.


HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline zparticle

Senior Member




Thick As A Brick


« Reply #7 - Posted 2003-04-25 17:02:42 »

yeah I had the translation values in the location for shear values. Duh! Tongue

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (86 views)
2013-05-17 21:29:12

alaslipknot (94 views)
2013-05-16 21:24:48

gouessej (126 views)
2013-05-16 00:53:38

gouessej (119 views)
2013-05-16 00:17:58

theagentd (129 views)
2013-05-15 15:01:13

theagentd (117 views)
2013-05-15 15:00:54

StreetDoggy (160 views)
2013-05-14 15:56:26

kutucuk (182 views)
2013-05-12 17:10:36

kutucuk (182 views)
2013-05-12 15:36:09

UnluckyDevil (189 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.102 seconds with 22 queries.