mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0030595: Oriented Bounding Box seems not optimal for some shapes
Add possibility of construction of the Optimal Oriented Bounding Box from set of points (the case of shape with triangulation). The interface of the BRepBndLib::AddOBB method is not changed, but the option <theIsOptimal> now controls also the construction of the OBB from Set of points. The slightly modified DiTo algorithm will be used, checking all possible axes created by the extreme points. The performance of the construction of the Optimal OBB is lower but the quality is usually much higher (can't be worse by definition). Test cases for the issue.
This commit is contained in:
@@ -93,9 +93,8 @@ public:
|
||||
//! be ignored at all.
|
||||
//! If theIsShapeToleranceUsed == TRUE then resulting box will be
|
||||
//! extended on the tolerance of the shape.
|
||||
//! theIsOptimal flag defines the algorithm for construction of initial
|
||||
//! Bnd_Box for the second method (if theIsOptimal == TRUE then
|
||||
//! this box will be created by AddOptimal(...) method).
|
||||
//! theIsOptimal flag defines whether to look for the more tight
|
||||
//! OBB for the cost of performance or not.
|
||||
Standard_EXPORT static
|
||||
void AddOBB(const TopoDS_Shape& theS,
|
||||
Bnd_OBB& theOBB,
|
||||
|
@@ -293,6 +293,7 @@ static Standard_Integer IsWCS(const gp_Dir& theDir)
|
||||
//=======================================================================
|
||||
static Standard_Boolean CheckPoints(const TopoDS_Shape& theS,
|
||||
const Standard_Boolean theIsTriangulationUsed,
|
||||
const Standard_Boolean theIsOptimal,
|
||||
const Standard_Boolean theIsShapeToleranceUsed,
|
||||
Bnd_OBB& theOBB)
|
||||
{
|
||||
@@ -329,7 +330,7 @@ static Standard_Boolean CheckPoints(const TopoDS_Shape& theS,
|
||||
}
|
||||
#endif
|
||||
|
||||
theOBB.ReBuild(anArrPnts, aPtrArrTol);
|
||||
theOBB.ReBuild(anArrPnts, aPtrArrTol, theIsOptimal);
|
||||
|
||||
return (!theOBB.IsVoid());
|
||||
}
|
||||
@@ -498,7 +499,7 @@ void BRepBndLib::AddOBB(const TopoDS_Shape& theS,
|
||||
const Standard_Boolean theIsOptimal,
|
||||
const Standard_Boolean theIsShapeToleranceUsed)
|
||||
{
|
||||
if(CheckPoints(theS, theIsTriangulationUsed, theIsShapeToleranceUsed, theOBB))
|
||||
if (CheckPoints(theS, theIsTriangulationUsed, theIsOptimal, theIsShapeToleranceUsed, theOBB))
|
||||
return;
|
||||
|
||||
ComputePCA(theS, theOBB, theIsTriangulationUsed, theIsOptimal, theIsShapeToleranceUsed);
|
||||
|
Reference in New Issue
Block a user