Author Topic: Object3D bounds?  (Read 5879 times)

Offline Mr.Marbles

  • int
  • **
  • Posts: 81
    • View Profile
Object3D bounds?
« 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Object3D bounds?
« Reply #1 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...

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Object3D bounds?
« Reply #2 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.
Nada por ahora

Offline Mr.Marbles

  • int
  • **
  • Posts: 81
    • View Profile
Object3D bounds?
« Reply #3 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 :?:  :?:

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Object3D bounds?
« Reply #4 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.

Offline Mr.Marbles

  • int
  • **
  • Posts: 81
    • View Profile
Object3D bounds?
« Reply #5 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Object3D bounds?
« Reply #6 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.

Offline Mr.Marbles

  • int
  • **
  • Posts: 81
    • View Profile
Object3D bounds?
« Reply #7 on: May 02, 2006, 07:26:31 pm »
Yes I was using an older version  :oops:  Thanks for the help!