Java-Gaming.org Hi !
 Featured games (84) games approved by the League of Dukes Games in Showcase (565) Games in Android Showcase (151) games submitted by our members Games in WIP (606) 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 858 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

You cannot reply to this message, because it is very, very old.

 ags1 (11 views) 2015-03-31 10:55:12 theagentd (13 views) 2015-03-27 23:08:20 wxwsk8er (54 views) 2015-03-20 15:39:46 Fairy Tailz (47 views) 2015-03-15 21:52:20 Olo (29 views) 2015-03-13 17:51:59 Olo (32 views) 2015-03-13 17:50:51 Olo (39 views) 2015-03-13 17:50:16 Olo (44 views) 2015-03-13 17:47:07 ClaasJG (58 views) 2015-03-10 11:36:42 ClaasJG (42 views) 2015-03-10 11:33:01
 LiquidNitrogen 21x BurntPizza 21x basil_ 20x KevinWorkman 18x theagentd 17x EgonOlsen 17x Roquen 16x 65K 11x wessles 11x Varkas 10x Riven 10x princec 9x Ashedragon 8x phu004 8x SHC 8x lcass 7x
 How to: JGO Wikiby Mac702015-02-17 20:56:162D Dynamic Lighting2015-01-01 20:25:42How do I start Java Game Development?by gouessej2014-12-27 19:41:21Resources for WIP gamesby kpars2014-12-18 10:26:14Understanding relations between setOrigin, setScale and setPosition in libGdx2014-10-09 22:35:00Definite guide to supporting multiple device resolutions on Android (2014)2014-10-02 22:36:02List of Learning Resources2014-08-16 10:40:00List of Learning Resources2014-08-05 19:33:27
 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