![Anonymous's picture Anonymous's picture](/sites/default/files/images/userpic_default.png)
Mon, 11/17/2003 - 14:22
Forums:
I'm trying to find the bounding box of a trimmed surface. I have tried iShape->BoundingBox(), BRepBndLib::Add and BndLib_AddSurface::Add but none of them seem to return the correct result.
Does anyone know of a more accurate method of finding a bounding box?
Thanks...Mark
Mon, 11/17/2003 - 15:01
I thought BRepBndLib (and more to the point,
Bnd_Box) was inaccurate as well until I discovered
the SetGap function. Bnd_Box automatically adds
a small gap around the actual bounding box and
pads the result. All you need to do is to
call SetGap(0.0) AFTER you've added your surfaces
to the box (not before). This should return an
accurate result.
Mon, 11/17/2003 - 15:05
Mark,
I found that to achieve an accurate bounding box, I had to set the Gap parameter to a large amount and then subtract it from the bounds afterwards:
Bnd_Box myBox;
BRepBndLib::Add (myShape, myBox );
double rGap = 1000.0;
myBox.SetGap(rGap);
myBox.Get(m_rXMin, m_rYMin, m_rZMin, m_rXMax, m_rYMax, m_rZMax);
// remove the gap from each result;
m_rXMin += rGap;
m_rYMin += rGap;
m_rZMin += rGap;
m_rXMax -= rGap;
m_rYMax -= rGap;
m_rZMax -= rGap;
Hope this helps,
Neil
Mon, 11/17/2003 - 15:20
What I should have added is that the data for the surfaces which I am having trouble with are imported through the IGES reader, if that offers any clues.
Thanks...Mark