mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0027117: BRepClass3d_SolidClassifier doesn't take into account vertex/edge/face tolerances
Various improvements in point-solid classifier: 1) Refactoring. 2) BndBoxTree is extracted into separate class. 3) UB-tree calculation is cashed to improve point-solid classification speed. 4) Ray / curve intersection improved by trimmed parameters and correct order. 5) Fixes in logic. 6) Calculation caching at the classifier level. 3D-claasifier now takes into the account the vertex/edges tolerances. If the given point lays inside the tolerance area of vertex or edge of the solid it's classified as TopAbs_ON. The behavior of IntCurvesFace_Intersector::Perform was changed. Now it may use optional null-tolerance to classify 2d-point relatively to the given face. UBTreeFiller is used to speedup intersection process between edges/vertices and the point. The test case 'boolean gdml_private ZH2' extensively uses the SolidClassifier. After this fix it returns the correct classification statuses, which leads to incorrect result shape (reported by checkshape). Yet the result shape without this fix also seems to be incorrect (one of the isolines goes out of boundary of the face). Thats why it's marked with 'TODO'. Corrections in test cases. Test case is added.
This commit is contained in:
@@ -57,14 +57,16 @@ GeomAbs_SurfaceType IntCurvesFace_Intersector::SurfaceType() const
|
||||
//=======================================================================
|
||||
IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face,
|
||||
const Standard_Real aTol,
|
||||
const Standard_Boolean aRestr)
|
||||
const Standard_Boolean aRestr,
|
||||
const Standard_Boolean UseBToler)
|
||||
|
||||
:
|
||||
Tol(aTol),
|
||||
done(Standard_False),
|
||||
nbpnt(0),
|
||||
PtrOnPolyhedron(NULL),
|
||||
PtrOnBndBounding(NULL)
|
||||
PtrOnBndBounding(NULL),
|
||||
myUseBoundTol (UseBToler)
|
||||
{
|
||||
BRepAdaptor_Surface surface;
|
||||
face = Face;
|
||||
@@ -146,8 +148,8 @@ void IntCurvesFace_Intersector::InternalCall(const IntCurveSurface_HInter &HICS,
|
||||
gp_Pnt2d Puv(HICSPointindex.U(),HICSPointindex.V());
|
||||
|
||||
//TopAbs_State currentstate = myTopolTool->Classify(Puv,Tol);
|
||||
TopAbs_State currentstate = myTopolTool->Classify(Puv, mintol2d);
|
||||
if(currentstate == TopAbs_OUT && maxtol2d > mintol2d) {
|
||||
TopAbs_State currentstate = myTopolTool->Classify(Puv, !myUseBoundTol ? 0 : mintol2d);
|
||||
if(myUseBoundTol && currentstate == TopAbs_OUT && maxtol2d > mintol2d) {
|
||||
if(anAdditionalTool.IsNull())
|
||||
{
|
||||
anAdditionalTool = new BRepTopAdaptor_TopolTool(Hsurface);
|
||||
@@ -399,5 +401,13 @@ void IntCurvesFace_Intersector::Destroy() {
|
||||
}
|
||||
}
|
||||
|
||||
void IntCurvesFace_Intersector::SetUseBoundToler(Standard_Boolean UseBToler)
|
||||
{
|
||||
myUseBoundTol = UseBToler;
|
||||
}
|
||||
|
||||
Standard_Boolean IntCurvesFace_Intersector::GetUseBoundToler() const
|
||||
{
|
||||
return myUseBoundTol;
|
||||
}
|
||||
|
||||
|
@@ -58,9 +58,13 @@ public:
|
||||
//! on the line can be a negative value (greater than -Tol).
|
||||
//! If aRestr = true UV bounding box of face is used to restrict
|
||||
//! it's underlined surface,
|
||||
//! otherwise surface is not restricted
|
||||
//! otherwise surface is not restricted.
|
||||
//! If UseBToler = false then the 2d-point of intersection is classified with null-tolerance
|
||||
//! (relative to face);
|
||||
//! otherwise it's using maximium between input tolerance(aTol) and tolerances of face bounds (edges).
|
||||
Standard_EXPORT IntCurvesFace_Intersector(const TopoDS_Face& F, const Standard_Real aTol,
|
||||
const Standard_Boolean aRestr = Standard_True);
|
||||
const Standard_Boolean aRestr = Standard_True,
|
||||
const Standard_Boolean UseBToler = Standard_True);
|
||||
|
||||
//! Perform the intersection between the
|
||||
//! segment L and the loaded face.
|
||||
@@ -117,6 +121,12 @@ public:
|
||||
Standard_EXPORT TopAbs_State ClassifyUVPoint (const gp_Pnt2d& Puv) const;
|
||||
|
||||
Standard_EXPORT Bnd_Box Bounding() const;
|
||||
|
||||
//! Sets the boundary tolerance flag
|
||||
Standard_EXPORT void SetUseBoundToler(Standard_Boolean UseBToler );
|
||||
|
||||
//! Returns the boundary tolerance flag
|
||||
Standard_EXPORT Standard_Boolean GetUseBoundToler() const;
|
||||
|
||||
Standard_EXPORT void Destroy();
|
||||
~IntCurvesFace_Intersector()
|
||||
@@ -149,6 +159,7 @@ private:
|
||||
TopoDS_Face face;
|
||||
Standard_Address PtrOnPolyhedron;
|
||||
Standard_Address PtrOnBndBounding;
|
||||
Standard_Boolean myUseBoundTol;
|
||||
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user