www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: Mr.Marbles on May 01, 2006, 03:21:01 pm

Title: Object3D bounds?
Post by: Mr.Marbles on May 01, 2006, 03:21:01 pm
Is there a way to get the bounds of an Object3D in world space? I need to draw a rectangle around an object in my gui. It's supposed to simulate a target tracking system. But I can't seem to find and bounds information. Java 3D had a getBoundingBox() method but I can't find a similar method in jpct.
Title: Object3D bounds?
Post by: EgonOlsen on May 01, 2006, 04:00:23 pm
This one may help:
http://www.jpct.net/doc/com/threed/jpct/Mesh.html#getBoundingBox()

Edit: I've no idea, why the forum software can't create a link out of this...anyway...
Title: Object3D bounds?
Post by: Melssj5 on May 02, 2006, 07:45:37 am
Quote from: "EgonOlsen"
This one may help:
http://www.jpct.net/doc/com/threed/jpct/Mesh.html#getBoundingBox()

Edit: I've no idea, why the forum software can't create a link out of this...anyway...


http://www.jpct.net/doc/com/threed/jpct/Mesh.html#getBoundingBox()

put them without the http://

Maybe the default options of the forums is set to avoid this kind of scripts.
Title: Object3D bounds?
Post by: Mr.Marbles on May 02, 2006, 02:44:33 pm
getBoundingBox() returns the coordinates of the Object3D in object space. How could I translate this into screen coordinates :?: Would I need to first convert them into world coordinates :?:  :?:
Title: Object3D bounds?
Post by: EgonOlsen on May 02, 2006, 04:56:59 pm
Yes. Transform them into world space by making SimpleVectros from it and apply the Object3D's world transformation matrix to those. Then project them into 2D using the methods in Interact2D.
Title: Object3D bounds?
Post by: Mr.Marbles on May 02, 2006, 05:27:14 pm
EgonOlsen,

Thanks for the help, but I'm still stuck on the conversion from 3D to 2D coordinates. The Interact2D.projectCenter3D2D() methods only convert the center point of an Object3D into screen coordinates. I don't see a way of converting an arbitrary SimpleVector.
Title: Object3D bounds?
Post by: EgonOlsen on May 02, 2006, 05:33:31 pm
Maybe you are using an older version of jPCT!? The latest has a method in Interact2D that takes and projects any SimpleVector instead of just an object's center.
Title: Object3D bounds?
Post by: Mr.Marbles on May 02, 2006, 07:26:31 pm
Yes I was using an older version  :oops:  Thanks for the help!