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

0026620: Shape healing unreasonably downgrades tolerance of a face

Added face support in SameParameter in classes ShapeAnalysis_Edge, ShapeFix_Edge.

Test case for issue CR26620

Minor correction.
This commit is contained in:
aml
2015-10-22 14:54:59 +03:00
committed by bugmaster
parent 7636352267
commit 98a4340017
9 changed files with 174 additions and 28 deletions

View File

@@ -772,6 +772,19 @@ Standard_Boolean ShapeAnalysis_Edge::ComputeDeviation (const Adaptor3d_Curve& CR
return OK;
}
//=======================================================================
//function : CheckSameParameter
//purpose :
//=======================================================================
Standard_Boolean ShapeAnalysis_Edge::CheckSameParameter (const TopoDS_Edge& edge,
Standard_Real& maxdev,
const Standard_Integer NbControl)
{
TopoDS_Face anEmptyFace;
return CheckSameParameter(edge, anEmptyFace, maxdev, NbControl);
}
//=======================================================================
//function : CheckSameParameter
@@ -779,8 +792,9 @@ Standard_Boolean ShapeAnalysis_Edge::ComputeDeviation (const Adaptor3d_Curve& CR
//=======================================================================
Standard_Boolean ShapeAnalysis_Edge::CheckSameParameter (const TopoDS_Edge& edge,
Standard_Real& maxdev,
const Standard_Integer NbControl)
const TopoDS_Face& face,
Standard_Real& maxdev,
const Standard_Integer NbControl)
{
myStatus = ShapeExtend::EncodeStatus ( ShapeExtend_OK );
if (BRep_Tool::Degenerated (edge)) return Standard_False;
@@ -814,12 +828,27 @@ Standard_Boolean ShapeAnalysis_Edge::CheckSameParameter (const TopoDS_Edge& edge
return Standard_False;
}
Handle(Geom_Surface) aFaceSurf;
TopLoc_Location L;
if ( !face.IsNull() )
{
aFaceSurf = BRep_Tool::Surface(face, L);
}
// iterate on pcurves
itcr.Initialize ( TE->Curves() );
for ( ; itcr.More(); itcr.Next() ) {
for ( ; itcr.More(); itcr.Next() )
{
Handle(BRep_GCurve) GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
if ( GC.IsNull() || ! GC->IsCurveOnSurface() ) continue;
if ( !(face.IsNull()) ) // Face is not null.
{
// Check for different surface.
if (!GC->IsCurveOnSurface(aFaceSurf, GC->Location()))
continue;
}
Standard_Real f, l;
GC->Range ( f, l );
Handle(Geom_Surface) Su = GC->Surface();
@@ -833,15 +862,18 @@ Standard_Boolean ShapeAnalysis_Edge::CheckSameParameter (const TopoDS_Edge& edge
//Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
Adaptor3d_CurveOnSurface ACS;
ACS.Load(GHPC, GAHS);
if ( ! ComputeDeviation ( AC3d, ACS, SameParameter, maxdev, NbControl-1 ) ) {
if ( ! ComputeDeviation ( AC3d, ACS, SameParameter, maxdev, NbControl-1 ) )
{
myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_FAIL2 );
}
if ( GC->IsCurveOnClosedSurface() ) {
if ( GC->IsCurveOnClosedSurface() )
{
GHPC->ChangeCurve2d().Load ( GC->PCurve2(), f, l ); // same bounds
ACS.Load(GHPC, GAHS); // sans doute inutile
if ( ! ComputeDeviation ( AC3d, ACS, SameParameter, maxdev, NbControl-1 ) ) {
myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_FAIL2 );
if ( ! ComputeDeviation ( AC3d, ACS, SameParameter, maxdev, NbControl-1 ) )
{
myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_FAIL2 );
}
}
}

View File

@@ -157,6 +157,15 @@ public:
//! If deviation is greater than tolerance of the edge (i.e.
//! incorrect flag) returns False, else returns True.
Standard_EXPORT Standard_Boolean CheckSameParameter (const TopoDS_Edge& edge, Standard_Real& maxdev, const Standard_Integer NbControl = 23);
//! Checks the edge to be SameParameter.
//! Calculates the maximal deviation between 3d curve and each
//! pcurve of the edge on <NbControl> equidistant points (the same
//! algorithm as in BRepCheck; default value is 23 as in BRepCheck).
//! This deviation is returned in <maxdev> parameter.
//! If deviation is greater than tolerance of the edge (i.e.
//! incorrect flag) returns False, else returns True.
Standard_EXPORT Standard_Boolean CheckSameParameter (const TopoDS_Edge& theEdge, const TopoDS_Face& theFace, Standard_Real& theMaxdev, const Standard_Integer theNbControl = 23);
//! Computes the maximal deviation between the two curve
//! representations.