Determining the height/width of an imported model

Hi, this might be a stupid question but… how do you get the dimensions (max width/length) of an imported model. (using Java3d)

Essentially, what I’m trying to do is draw a movable, resizable, and rotatable ellipse and keep it confined within a certain rectangular space - no parts of the ellipse must be outside of that space. That space has the same dimensions (width, length) as an imported model, but I don’t know how to get that width/length…

The method that I’ve thought up of keeping that ellipse in the space, involves me knowing how much of that ellipse is outside of the rectangular space - so knowing whether or not it’s completely inside the space alone after a transformation is not enough and hence the need for the width/length.

So can anyone provide me some info about finding the dimensions? Thanks

If you do a getBounds() on a Shape3D it wil lreturn an axis aligned bounding box for the geoemtry contained in the Shape3D.

BUT it gets compelx if your model is made of multiple Shape3DS. Usually a mdoel made of Multiple Shape3Ds has transforms that connect the shapes to allow for independant positionign and rotation. If you do getBounds() on a Transform that has a hape3D beneath it (what you get is a bouding SPHERE which is the area that could potentially be occupied by the shape3D in all possible rotational positions of the Transform.

AND it gets even mreo complex in that if you getBounds on a node with multiple transform children, what you get is the merged super-sphere of the sub bounding spheres.

Short answer is that, if your looking for the bounds of a complex object at one aprticualr state (eg rest state as loaded) you are going to have to doa getBOunds() on each shape3D and manually transform the results with the localToVWorld for each arm of the tree and then combine them yourself.

Have fun. I looked at this a few times and decided it was more work then I wanted to bother with.

I don’t see how bounds can be useful in my case.

To my knowledge it just determines if one bounding box intersects with another bounding box right? And the intersect functions only return a boolean value. In the end, I just want to find the width/length of the model or better yet how much of the ellipse is outside of the bounds of the rectangle.

My program in a nutshell. If the player rotates/resizes/moves the ellipse so that it’s partly outside the rectangle, the program would shrink and/or move the ellipse so that it is just inside the rectangle and a given point P also inside the rectangle (the player) is on the ellipse. The player (point P) must always be on the ellipse. It’s actually even abit more complicated…but this problem is for me to solve, so it doesn’t really matter :smiley:

But figuring out the width/length of the model or bounding box of that model has really got me stumped ???

You want max and min.

Thats a bounds.

Go look at BoundingBox and BoundingSphere in the API docs.