Java-Gaming.org Hi !
 Featured games (90) games approved by the League of Dukes Games in Showcase (754) Games in Android Showcase (229) games submitted by our members Games in WIP (842) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
Pages: [1]
 ignore  |  Print
 Transform3D Questions  (Read 2670 times) 0 Members and 1 Guest are viewing this topic.
zparticle

Senior Devvie

Thick As A Brick

 « Posted 2003-04-23 12: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.

zparticle

Senior Devvie

Thick As A Brick

 « Reply #1 - Posted 2003-04-23 12: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?

zparticle

Senior Devvie

Thick As A Brick

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

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

Herkules

Senior Devvie

Friendly fire isn't friendly!

 « Reply #3 - Posted 2003-04-25 13: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
Herkules

Senior Devvie

Friendly fire isn't friendly!

 « Reply #4 - Posted 2003-04-25 14: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
zparticle

Senior Devvie

Thick As A Brick

 « Reply #5 - Posted 2003-04-25 14: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.

Herkules

Senior Devvie

Friendly fire isn't friendly!

 « Reply #6 - Posted 2003-04-25 14: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
zparticle

Senior Devvie

Thick As A Brick

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

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

Pages: [1]
 ignore  |  Print

 DesertCoockie (20 views) 2018-05-13 18:23:11 nelsongames (68 views) 2018-04-24 18:15:36 nelsongames (65 views) 2018-04-24 18:14:32 ivj94 (748 views) 2018-03-24 14:47:39 ivj94 (79 views) 2018-03-24 14:46:31 ivj94 (595 views) 2018-03-24 14:43:53 Solater (95 views) 2018-03-17 05:04:08 nelsongames (168 views) 2018-03-05 17:56:34 Gornova (378 views) 2018-03-02 22:15:33 buddyBro (1038 views) 2018-02-28 16:59:18
 Java Gaming Resourcesby philfrei2017-12-05 19:38:37Java Gaming Resourcesby philfrei2017-12-05 19:37:39Java Gaming Resourcesby philfrei2017-12-05 19:36:10Java Gaming Resourcesby philfrei2017-12-05 19:33:10List of Learning Resourcesby elect2017-03-13 14:05:44List of Learning Resourcesby elect2017-03-13 14:04:45SF/X Librariesby philfrei2017-03-02 08:45:19SF/X Librariesby philfrei2017-03-02 08:44:05
 java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org