Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Determining the height/width of an imported model  (Read 751 times)
0 Members and 1 Guest are viewing this topic.
Offline NB

Junior Newbie





« Posted 2005-08-29 23: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
Offline Jeff

JGO Coder




Got any cats?


« Reply #1 - Posted 2005-08-30 02: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
Offline NB

Junior Newbie





« Reply #2 - Posted 2005-08-30 03: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   Cheesy

But figuring out the width/length of the model or bounding box of that model has really got me stumped  Huh
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder




Got any cats?


« Reply #3 - Posted 2005-09-01 06: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.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (47 views)
2014-04-15 18:08:23

BurntPizza (43 views)
2014-04-15 03:46:01

UprightPath (59 views)
2014-04-14 17:39:50

UprightPath (41 views)
2014-04-14 17:35:47

Porlus (57 views)
2014-04-14 15:48:38

tom_mai78101 (80 views)
2014-04-10 04:04:31

BurntPizza (139 views)
2014-04-08 23:06:04

tom_mai78101 (239 views)
2014-04-05 13:34:39

trollwarrior1 (199 views)
2014-04-04 12:06:45

CJLetsGame (207 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!