Hi again,
The original getBounds() assumes that the axis extends in both
directions from the position, which is wrong compared to how it is
defined in other functions.
I've written a replacement which seems to behave correctly. (At least by
visual inspection when drawing the resulting OOBB as a box around the
object).
void myGetBounds(const CylinderVolume* vol, Pnt3f &min, Pnt3f &max)
{
osg::Pnt3f pos;
osg::Vec3f dir;
float radius = cyl->getRadius();
cyl->getAxis(pos, dir);
for(int i=0; i<3; i++) {
min[i] = pos[i] - radius;
max[i] = pos[i] + radius;
((dir[i] < 0) ? min[i] : max[i]) += dir[i];
}
}
Regards,
/Marcus
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users