1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0032448: Modeling Algorithms - Provide exact validating (as option) using GeomLib_CheckCurveOnSurface

Add '-exact' option to checkshape command to use exact method to validate edges using BRepLib_ValidateEdge class. Default mode is calculating in finite number of points.
This commit is contained in:
akaftasev
2021-10-28 19:23:37 +03:00
committed by inv
parent 6eddc28410
commit 0ffecc2fc7
27 changed files with 324 additions and 62 deletions

View File

@@ -346,8 +346,7 @@ private:
//purpose :
//=======================================================================
void BRepCheck_Analyzer::Init (const TopoDS_Shape& theShape,
const Standard_Boolean B,
const Standard_Boolean theIsParallel)
const Standard_Boolean B)
{
if (theShape.IsNull())
{
@@ -356,8 +355,8 @@ void BRepCheck_Analyzer::Init (const TopoDS_Shape& theShape,
myShape = theShape;
myMap.Clear();
Put (theShape, B, theIsParallel);
Perform (theIsParallel);
Put (theShape, B);
Perform();
}
//=======================================================================
@@ -365,8 +364,7 @@ void BRepCheck_Analyzer::Init (const TopoDS_Shape& theShape,
//purpose :
//=======================================================================
void BRepCheck_Analyzer::Put (const TopoDS_Shape& theShape,
const Standard_Boolean B,
const Standard_Boolean theIsParallel)
const Standard_Boolean B)
{
if (myMap.Contains (theShape))
{
@@ -382,6 +380,7 @@ void BRepCheck_Analyzer::Put (const TopoDS_Shape& theShape,
case TopAbs_EDGE:
HR = new BRepCheck_Edge (TopoDS::Edge (theShape));
Handle(BRepCheck_Edge)::DownCast(HR)->GeometricControls (B);
Handle(BRepCheck_Edge)::DownCast(HR)->SetExactMethod(myIsExact);
break;
case TopAbs_WIRE:
HR = new BRepCheck_Wire (TopoDS::Wire (theShape));
@@ -406,13 +405,13 @@ void BRepCheck_Analyzer::Put (const TopoDS_Shape& theShape,
if (!HR.IsNull())
{
HR->SetParallel (theIsParallel);
HR->SetParallel (myIsParallel);
}
myMap.Add (theShape, HR);
for (TopoDS_Iterator theIterator (theShape); theIterator.More(); theIterator.Next())
{
Put (theIterator.Value(), B, theIsParallel); // performs minimum on each shape
Put (theIterator.Value(), B); // performs minimum on each shape
}
}
@@ -420,7 +419,7 @@ void BRepCheck_Analyzer::Put (const TopoDS_Shape& theShape,
//function : Perform
//purpose :
//=======================================================================
void BRepCheck_Analyzer::Perform (Standard_Boolean theIsParallel)
void BRepCheck_Analyzer::Perform()
{
const Standard_Integer aMapSize = myMap.Size();
const Standard_Integer aMinTaskSize = 10;
@@ -453,7 +452,7 @@ void BRepCheck_Analyzer::Perform (Standard_Boolean theIsParallel)
}
BRepCheck_ParallelAnalyzer aParallelAnalyzer (aArrayOfArray, myMap);
OSD_Parallel::For (0, aArrayOfArray.Size(), aParallelAnalyzer, !theIsParallel);
OSD_Parallel::For (0, aArrayOfArray.Size(), aParallelAnalyzer, !myIsParallel);
}
//=======================================================================

View File

@@ -59,9 +59,12 @@ public:
//! BRepCheck_SelfIntersectingWire
BRepCheck_Analyzer (const TopoDS_Shape& S,
const Standard_Boolean GeomControls = Standard_True,
const Standard_Boolean theIsParallel = Standard_False)
const Standard_Boolean theIsParallel = Standard_False,
const Standard_Boolean theIsExact = Standard_False)
: myIsParallel(theIsParallel),
myIsExact(theIsExact)
{
Init (S, GeomControls, theIsParallel);
Init (S, GeomControls);
}
//! <S> is the shape to control. <GeomControls> If
@@ -81,8 +84,35 @@ public:
//! For a wire :
//! BRepCheck_SelfIntersectingWire
Standard_EXPORT void Init (const TopoDS_Shape& S,
const Standard_Boolean GeomControls = Standard_True,
const Standard_Boolean theIsParallel = Standard_False);
const Standard_Boolean GeomControls = Standard_True);
//! Sets method to calculate distance: Calculating in finite number of points (if theIsExact
//! is false, faster, but possible not correct result) or exact calculating by using
//! BRepLib_CheckCurveOnSurface class (if theIsExact is true, slowly, but more correctly).
//! Exact method is used only when edge is SameParameter.
//! Default method is calculating in finite number of points
void SetExactMethod(const Standard_Boolean theIsExact)
{
myIsExact = theIsExact;
}
//! Returns true if exact method selected
Standard_Boolean IsExactMethod()
{
return myIsExact;
}
//! Sets parallel flag
void SetParallel(const Standard_Boolean theIsParallel)
{
myIsParallel = theIsParallel;
}
//! Returns true if parallel flag is set
Standard_Boolean IsParallel()
{
return myIsParallel;
}
//! <S> is a subshape of the original shape. Returns
//! <STandard_True> if no default has been detected on
@@ -141,10 +171,9 @@ public:
private:
Standard_EXPORT void Put (const TopoDS_Shape& S,
const Standard_Boolean Gctrl,
const Standard_Boolean theIsParallel);
const Standard_Boolean Gctrl);
Standard_EXPORT void Perform (Standard_Boolean theIsParallel);
Standard_EXPORT void Perform();
Standard_EXPORT Standard_Boolean ValidSub (const TopoDS_Shape& S, const TopAbs_ShapeEnum SubType) const;
@@ -152,6 +181,8 @@ private:
TopoDS_Shape myShape;
BRepCheck_IndexedDataMapOfShapeResult myMap;
Standard_Boolean myIsParallel;
Standard_Boolean myIsExact;
};

View File

@@ -75,6 +75,7 @@ BRepCheck_Edge::BRepCheck_Edge(const TopoDS_Edge& E)
{
Init(E);
myGctrl = Standard_True;
myIsExactMethod = Standard_False;
}
//=======================================================================
@@ -321,6 +322,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
Standard_Real eps = Precision::PConfusion();
Standard_Boolean toRunParallel = !myMutex.IsNull();
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
@@ -385,6 +387,8 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
BRepLib_ValidateEdge aValidateEdge(myHCurve, ACS, SameParameter);
aValidateEdge.SetExitIfToleranceExceeded(Tol);
aValidateEdge.SetExactMethod(myIsExactMethod);
aValidateEdge.SetParallel(toRunParallel);
aValidateEdge.Process();
if (!aValidateEdge.IsDone() || !aValidateEdge.CheckTolerance(Tol))
{
@@ -407,6 +411,8 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
BRepLib_ValidateEdge aValidateEdgeOnClosedSurf(myHCurve, ACS, SameParameter);
aValidateEdgeOnClosedSurf.SetExitIfToleranceExceeded(Tol);
aValidateEdgeOnClosedSurf.SetExactMethod(myIsExactMethod);
aValidateEdgeOnClosedSurf.SetParallel(toRunParallel);
aValidateEdgeOnClosedSurf.Process();
if (!aValidateEdgeOnClosedSurf.IsDone() || !aValidateEdgeOnClosedSurf.CheckTolerance(Tol))
{
@@ -466,6 +472,8 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
BRepLib_ValidateEdge aValidateEdgeProj(myHCurve, ACS, SameParameter);
aValidateEdgeProj.SetExitIfToleranceExceeded(Tol);
aValidateEdgeProj.SetExactMethod(myIsExactMethod);
aValidateEdgeProj.SetParallel(toRunParallel);
aValidateEdgeProj.Process();
if (!aValidateEdgeProj.IsDone() || !aValidateEdgeProj.CheckTolerance(Tol))
{

View File

@@ -51,7 +51,23 @@ public:
//! Sets status of Edge;
Standard_EXPORT void SetStatus (const BRepCheck_Status theStatus);
//! Sets method to calculate distance: Calculating in finite number of points (if theIsExact
//! is false, faster, but possible not correct result) or exact calculating by using
//! BRepLib_CheckCurveOnSurface class (if theIsExact is true, slowly, but more correctly).
//! Exact method is used only when edge is SameParameter.
//! Default method is calculating in finite number of points
void SetExactMethod(Standard_Boolean theIsExact)
{
myIsExactMethod = theIsExact;
}
//! Returns true if exact method selected
Standard_Boolean IsExactMethod()
{
return myIsExactMethod;
}
//! Checks, if polygon on triangulation of heEdge
//! is out of 3D-curve of this edge.
Standard_EXPORT BRepCheck_Status CheckPolygonOnTriangulation (const TopoDS_Edge& theEdge);
@@ -64,7 +80,7 @@ private:
Handle(BRep_CurveRepresentation) myCref;
Handle(Adaptor3d_Curve) myHCurve;
Standard_Boolean myGctrl;
Standard_Boolean myIsExactMethod;
};
#endif // _BRepCheck_Edge_HeaderFile