Java-Gaming.org Hi !
 Featured games (91) games approved by the League of Dukes Games in Showcase (757) Games in Android Showcase (229) games submitted by our members Games in WIP (844) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
Pages: [1]
 ignore  |  Print
 Determining the height/width of an imported model  (Read 1529 times) 0 Members and 1 Guest are viewing this topic.
NB

Junior Newbie

 « Posted 2005-08-29 21:34:26 »

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
Jeff

JGO Coder

Got any cats?

 « Reply #1 - Posted 2005-08-30 00:06:04 »

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.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
NB

Junior Newbie

 « Reply #2 - Posted 2005-08-30 01:39:07 »

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

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

JGO Coder

Got any cats?

 « Reply #3 - Posted 2005-09-01 04:14:50 »

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

You want max and min.

Thats a bounds.

Go look at BoundingBox and BoundingSphere in the API docs.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Pages: [1]
 ignore  |  Print

 EgonOlsen (58 views) 2018-06-10 19:43:48 EgonOlsen (40 views) 2018-06-10 19:43:44 EgonOlsen (60 views) 2018-06-10 19:43:20 DesertCoockie (225 views) 2018-05-13 18:23:11 nelsongames (141 views) 2018-04-24 18:15:36 nelsongames (140 views) 2018-04-24 18:14:32 ivj94 (881 views) 2018-03-24 14:47:39 ivj94 (142 views) 2018-03-24 14:46:31 ivj94 (793 views) 2018-03-24 14:43:53 Solater (157 views) 2018-03-17 05:04:08
 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