Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (568)
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 1379 times)
0 Members and 1 Guest are viewing this topic.
Offline zparticle

Senior Member




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.

Offline zparticle

Senior Member




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?

Offline zparticle

Senior Member




Thick As A Brick


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

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

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Herkules

Senior Member




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
Offline Herkules

Senior Member




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
Offline zparticle

Senior Member




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.

Offline Herkules

Senior Member




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
Offline zparticle

Senior Member




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! Tongue

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

 

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

The first screenshot will be displayed as a thumbnail.

Pippogeek (39 views)
2014-09-24 16:13:29

Pippogeek (30 views)
2014-09-24 16:12:22

Pippogeek (20 views)
2014-09-24 16:12:06

Grunnt (46 views)
2014-09-23 14:38:19

radar3301 (28 views)
2014-09-21 23:33:17

BurntPizza (64 views)
2014-09-21 02:42:18

BurntPizza (36 views)
2014-09-21 01:30:30

moogie (42 views)
2014-09-21 00:26:15

UprightPath (51 views)
2014-09-20 20:14:06

BurntPizza (54 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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
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!