<Fundamental Shapes|User's Guide|Cylinder>

Box

See Box

Box provides a TriMesh that is an enclosed shape with six sides that are Axis-aligned. The Box generated is based upon a number of possible criteria, first a minimum and maximum point. All eight points are generated from these two points. Secondly, you may provide the box with a center point and a number of extents from that center for each axis.

(Boxes actually have 24 vertexex, not 8: 3 vertexes at each corner. This is so that each box corner can have different material properties for each of the three faces that it intersects. For single-material boxes, an 8-vertex box would be more efficient.).

Example 1 - Generate a Box with Minimum and Maximum Points

//We will create a box with sides of length 10 and will be centered
//about the origin.
Vector3f min = new Vector3f(-5, -5, -5);
Vector3f max = new Vector3f(5, 5, 5);
Box b = new Box("box", min, max);
 
//Let's change the box size
//Making it twice as wide
Vector3f min2 = new Vector3f(-10, -5, -5);
Vector3f max2 = new Vector3f(10, 5, 5);
b.setData(min2, max2);

Example 2 - Generate a Box using Center and Extents

//We will create a box with sides of length 10 and will be centered
//about the origin.
Vector3f center = new Vector3f(0, 0, 0);
Box b = new Box("box", center, 5, 5, 5);
 
//Let's change the box size
//Making it twice as wide
b.setData(center, 10, 5, 5);

<Fundamental Shapes|User's Guide|Cylinder>


/var/www/wiki/data/pages/box.txt · Last modified: 2009/07/28 18:44 (external edit)  
Recent changes · Show pagesource · Login

Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki

subscribe to jME latest jme headlines


site design by bleedcrimson designs © 2008