Page 1 of 1
getBoundingBox() --doubt
Posted: Tue Jul 25, 2006 6:56 pm
by hkolli
hi all ,
when we use getBoundingBox() function we get the values regarding it's x,y,z planes .... how do i access them .
thanks
Posted: Tue Jul 25, 2006 7:43 pm
by vitek
The bounding box just knows the min and max of the bounding area. It knows nothing about orientation. Well, it is always oriented with the coordinate system axes, so the orientation of the box is always the identity matrix.
In model space the planes are just this...
Code: Select all
core::plane3df xy(0, 0, 0, 0, 0, 1);
core::plane3df xz(0, 0, 0, 0, 1, 0);
core::plane3df yz(0, 0, 0, 1, 0, 0);
If you want that information in some other coordinate system, you need to apply the appropriate matrix transform to the plane.
Code: Select all
// this would transform the above planes into world space
node->getAbsoluteTransformation().transformPlane(xy);
node->getAbsoluteTransformation().transformPlane(xz);
node->getAbsoluteTransformation().transformPlane(yz);
It sounds like you may want the planes of the axis aligned box. If you want this, then you need to do no rotation, you just need to offset the plane position by half of the box extents.
Posted: Wed Jul 26, 2006 4:38 pm
by hkolli
hi
is the following code not valid
// D3DRMBOX box;
core::aabbox3d<f32> Box;
//meshBuilder -> GetBox( &box );
Box=anode->getBoundingBox();
s32 sizex = Box.T maxx - Box.T minx;
s32 sizey = Box.T maxy - Box.T miny;
s32 sizez = Box.T maxz - Box.T minz;
// Find the average of the flyer's three dimensions.
size = ( sizex + sizey + sizez ) / 3.0;
thanks
hkolli
Posted: Wed Jul 26, 2006 4:39 pm
by hkolli
hi ,
is this correct
Box=anode->getBoundingBox();
s32 sizex = Box.T maxx - Box.T minx;
s32 sizey = Box.T maxy - Box.T miny;
s32 sizez = Box.T maxz - Box.T minz;
thanks
hkolli
Posted: Wed Jul 26, 2006 10:23 pm
by vitek
Well, it would be simpler to say...
Code: Select all
core::vector3df size = node->getBoundingBox().getExtent();
// size.x, y and z are the dimensions of the box
core::vector3df center = node->getBoundingBox().getCenter();
// center.x, y and z mark the center of the bounding box
Posted: Thu Jul 27, 2006 1:09 pm
by hkolli
thanks
vitek