#include <BRep_PolygonOnTriangulation.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_TFace.hxx>
+
+#include <BRepAdaptor_Curve.hxx>
+
+#include <BRep_CurveRepresentation.hxx>
+#include <BRep_ListOfCurveRepresentation.hxx>
+#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
+#include <BRep_GCurve.hxx>
+#include <BRep_CurveOnSurface.hxx>
+
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepCheck.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Plane.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
+
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+
#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <Precision.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRepCheck_Edge,BRepCheck_Result)
+//Golden ratio
+static const Standard_Real GoldRatio = (sqrt(5.0)-1)/2.0;
+
+static const Standard_Real DivPoints[] = {
+ GoldRatio,
+ 1.0-GoldRatio,
+ 4.0*GoldRatio-2.0,
+ 3.0-4.0*GoldRatio,
+ 0.5
+ };
+
+static const Standard_Integer maxNIter = sizeof(DivPoints)/sizeof(DivPoints[0]);
+
//modified by NIZNHY-PKV Thu May 05 09:01:57 2011f
static
Standard_Boolean Validate(const Adaptor3d_Curve&,
- const Adaptor3d_CurveOnSurface&,
- const Standard_Real,
- const Standard_Boolean);
+ const Adaptor3d_CurveOnSurface&,
+ const Standard_Real,
+ const Standard_Boolean);
+
static
void PrintProblematicPoint(const gp_Pnt&,
- const Standard_Real,
- const Standard_Real);
+ const Standard_Real,
+ const Standard_Real);
static
Standard_Real Prec(const Adaptor3d_Curve& aAC3D,
- const Adaptor3d_CurveOnSurface& aACS);
+ const Adaptor3d_CurveOnSurface& aACS);
//static Standard_Boolean Validate(const Adaptor3d_Curve&,
// const Adaptor3d_Curve&,
Standard_Boolean unique = Standard_True;
// Search for a 3D reference. If no existent one, creates it with the
// first encountered CurveOnSurf; if multiple, chooses the first one...
-
+
Standard_Boolean Degenerated = TE->Degenerated();
Standard_Boolean SameParameter = TE->SameParameter();
Standard_Boolean SameRange = TE->SameRange();
if (!SameRange && SameParameter) {
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
- // Handle(Geom_Curve) C3d;
+// Handle(Geom_Curve) C3d;
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurve3D()) {
- if (!exist) {
- exist = Standard_True;
- }
- else {
- unique = Standard_False;
- }
- if (myCref.IsNull() && !cr->Curve3D().IsNull()) {
- myCref = cr;
- }
+ if (!exist) {
+ exist = Standard_True;
+ }
+ else {
+ unique = Standard_False;
+ }
+ if (myCref.IsNull() && !cr->Curve3D().IsNull()) {
+ myCref = cr;
+ }
}
itcr.Next();
}
if (myCref.IsNull() && !Degenerated) {
itcr.Initialize(TE->Curves());
while (itcr.More()) {
- const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
- if (cr->IsCurveOnSurface()) {
- myCref = cr;
- break;
- }
- itcr.Next();
+ const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
+ if (cr->IsCurveOnSurface()) {
+ myCref = cr;
+ break;
+ }
+ itcr.Next();
}
}
else if (!myCref.IsNull() && Degenerated){
Standard_Real First,Last;
GCref->Range(First,Last);
if (Last<=First) {
- myCref.Nullify();
- BRepCheck::Add(lst,BRepCheck_InvalidRange);
+ myCref.Nullify();
+ BRepCheck::Add(lst,BRepCheck_InvalidRange);
}
else {
- if (myCref->IsCurve3D()) {
+ if (myCref->IsCurve3D()) {
// eap 6 Jun 2002 occ332
// better transform C3d instead of transforming Surf upto C3d initial location,
// on transformed BSpline surface 'same parameter' may seem wrong
TopLoc_Location L = myShape.Location() * myCref->Location();
- Handle(Geom_Curve) C3d = Handle(Geom_Curve)::DownCast
- (myCref->Curve3D()->Transformed
- (/*myCref->Location()*/L.Transformation()));
+ Handle(Geom_Curve) C3d = Handle(Geom_Curve)::DownCast
+ (myCref->Curve3D()->Transformed
+ (/*myCref->Location()*/L.Transformation()));
Standard_Boolean IsPeriodic = C3d->IsPeriodic();
Standard_Real aPeriod = RealLast();
if(IsPeriodic)
{
aPeriod = C3d->Period();
- }
+ }
Standard_Real f = C3d->FirstParameter(), l = C3d->LastParameter();
if (C3d->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve))
{
myHCurve = new GeomAdaptor_Curve(GAC3d);
}
}
- else { // curve on surface
- Handle(Geom_Surface) Sref = myCref->Surface();
- Sref = Handle(Geom_Surface)::DownCast
- (Sref->Transformed(myCref->Location().Transformation()));
- const Handle(Geom2d_Curve)& PCref = myCref->PCurve();
+ else { // curve on surface
+ Handle(Geom_Surface) Sref = myCref->Surface();
+ Sref = Handle(Geom_Surface)::DownCast
+ (Sref->Transformed(myCref->Location().Transformation()));
+ const Handle(Geom2d_Curve)& PCref = myCref->PCurve();
Standard_Boolean IsPeriodic = PCref->IsPeriodic();
Standard_Real aPeriod = RealLast();
if(IsPeriodic)
Handle(GeomAdaptor_Surface) GAHSref = new GeomAdaptor_Surface(Sref);
Handle(Geom2dAdaptor_Curve) GHPCref =
new Geom2dAdaptor_Curve(PCref,First,Last);
- Adaptor3d_CurveOnSurface ACSref(GHPCref,GAHSref);
+ Adaptor3d_CurveOnSurface ACSref(GHPCref,GAHSref);
myHCurve = new Adaptor3d_CurveOnSurface(ACSref);
- }
- }
+ }
}
}
+ }
if (lst.IsEmpty()) {
lst.Append(BRepCheck_NoError);
}
Standard_Real Tol = BRep_Tool::Tolerance(TopoDS::Edge(myShape));
TopAbs_ShapeEnum styp = S.ShapeType();
- // for (TopExp_Explorer exp(S,TopAbs_EDGE); exp.More(); exp.Next()) {
+// for (TopExp_Explorer exp(S,TopAbs_EDGE); exp.More(); exp.Next()) {
TopExp_Explorer exp(S,TopAbs_EDGE) ;
for ( ; exp.More(); exp.Next()) {
if (exp.Current().IsSame(myShape)) {
BRepCheck::Add(lst,BRepCheck_SubshapeNotInShape);
return;
}
-
+
switch (styp)
{
case TopAbs_WIRE:
{
+ //if (CheckTolerance(TopoDS::Edge(myShape)) == BRepCheck_CollapsedEdge)
+ //{
+ // BRepCheck::Add(lst,BRepCheck_CollapsedEdge);
+ // return;
+ //}
}
break;
case TopAbs_FACE:
if (!myCref.IsNull()) {
-
+
Standard_Boolean SameParameter = TE->SameParameter();
Standard_Boolean SameRange = TE->SameRange();
- // Modified by skv - Tue Apr 27 11:48:13 2004 Begin
+
+// Modified by skv - Tue Apr 27 11:48:13 2004 Begin
if (!SameParameter || !SameRange) {
- if (!SameParameter)
- BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
- if (!SameRange)
- BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
+ if (!SameParameter)
+ BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
+ if (!SameRange)
+ BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
- return;
+ return;
}
- // Modified by skv - Tue Apr 27 11:48:14 2004 End
+// Modified by skv - Tue Apr 27 11:48:14 2004 End
Standard_Real First = myHCurve->FirstParameter();
Standard_Real Last = myHCurve->LastParameter();
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
Standard_Real eps = Precision::PConfusion();
while (itcr.More()) {
- const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
- if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
- pcurvefound = Standard_True;
+ const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
+ if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
+ pcurvefound = Standard_True;
Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr));
- Standard_Real f,l;
- GC->Range(f,l);
+ Standard_Real f,l;
+ GC->Range(f,l);
Standard_Real ff = f, ll = l;
if(myCref->IsCurve3D())
{
ll = myCref->Curve3D()->TransformedParameter(l, Etrsf);
}
// gka OCC
- // Modified by skv - Tue Apr 27 11:50:35 2004 Begin
+// Modified by skv - Tue Apr 27 11:50:35 2004 Begin
if (Abs(ff-First) > eps ||
Abs(ll-Last) > eps) {
- BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
- BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
- }
- // Modified by skv - Tue Apr 27 11:50:37 2004 End
+ BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
+ BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
+ }
+// Modified by skv - Tue Apr 27 11:50:37 2004 End
//
const Handle(Geom2d_Curve)& pc = cr->PCurve();
Standard_Boolean IsPeriodic = pc->IsPeriodic();
return;
}
- if (myGctrl) {
- Handle(Geom_Surface) Sb = cr->Surface();
- Sb = Handle(Geom_Surface)::DownCast
- // (Su->Transformed(L.Transformation()));
- (Su->Transformed(/*L*/(Floc * TFloc).Transformation()));
- Handle(Geom2d_Curve) PC = cr->PCurve();
+ if (myGctrl) {
+ Handle(Geom_Surface) Sb = cr->Surface();
+ Sb = Handle(Geom_Surface)::DownCast
+// (Su->Transformed(L.Transformation()));
+ (Su->Transformed(/*L*/(Floc * TFloc).Transformation()));
+ Handle(Geom2d_Curve) PC = cr->PCurve();
Handle(GeomAdaptor_Surface) GAHS = new GeomAdaptor_Surface(Sb);
Handle(Geom2dAdaptor_Curve) GHPC = new Geom2dAdaptor_Curve(PC,f,l);
- Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
+ Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
Standard_Boolean ok = Validate (*myHCurve, ACS, Tol, SameParameter);
- if (!ok) {
- if (cr->IsCurveOnClosedSurface()) {
- BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
- }
- else {
- BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
- }
- // Modified by skv - Tue Apr 27 11:53:00 2004 Begin
- BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
- // if (SameParameter) {
- // BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
- // }
- // Modified by skv - Tue Apr 27 11:53:01 2004 End
- }
- if (cr->IsCurveOnClosedSurface()) {
+ if (!ok) {
+ if (cr->IsCurveOnClosedSurface()) {
+ BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
+ }
+ else {
+ BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
+ }
+// Modified by skv - Tue Apr 27 11:53:00 2004 Begin
+ BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
+// if (SameParameter) {
+// BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
+// }
+// Modified by skv - Tue Apr 27 11:53:01 2004 End
+ }
+ if (cr->IsCurveOnClosedSurface()) {
GHPC->Load(cr->PCurve2(),f,l); // same bounds
ACS.Load(GHPC, GAHS); // sans doute inutile
ok = Validate(*myHCurve,ACS,Tol,SameParameter);
- if (!ok) {
- BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
- // Modified by skv - Tue Apr 27 11:53:20 2004 Begin
- if (SameParameter) {
- BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
- }
- // Modified by skv - Tue Apr 27 11:53:23 2004 End
- }
- }
- }
- }
- itcr.Next();
+ if (!ok) {
+ BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
+// Modified by skv - Tue Apr 27 11:53:20 2004 Begin
+ if (SameParameter) {
+ BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
+ }
+// Modified by skv - Tue Apr 27 11:53:23 2004 End
+ }
+ }
+ }
+ }
+ itcr.Next();
}
if (!pcurvefound) {
- Handle(Geom_Plane) P;
- Handle(Standard_Type) dtyp = Su->DynamicType();
- if (dtyp == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
- P = Handle(Geom_Plane)::DownCast
- (Handle(Geom_RectangularTrimmedSurface)::
- DownCast(Su)->BasisSurface());
- }
- else {
- P = Handle(Geom_Plane)::DownCast(Su);
- }
- if (P.IsNull()) { // not a plane
- BRepCheck::Add(lst,BRepCheck_NoCurveOnSurface);
- }
- else { // on fait la projection a la volee, comme BRep_Tool
- // plan en position
- if (myGctrl) {
- P = Handle(Geom_Plane)::
- DownCast(P->Transformed(/*L*/(Floc * TFloc).Transformation()));// eap occ332
- //on projette Cref sur ce plan
+ Handle(Geom_Plane) P;
+ Handle(Standard_Type) dtyp = Su->DynamicType();
+ if (dtyp == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
+ P = Handle(Geom_Plane)::DownCast
+ (Handle(Geom_RectangularTrimmedSurface)::
+ DownCast(Su)->BasisSurface());
+ }
+ else {
+ P = Handle(Geom_Plane)::DownCast(Su);
+ }
+ if (P.IsNull()) { // not a plane
+ BRepCheck::Add(lst,BRepCheck_NoCurveOnSurface);
+ }
+ else { // on fait la projection a la volee, comme BRep_Tool
+ // plan en position
+ if (myGctrl) {
+ P = Handle(Geom_Plane)::
+ DownCast(P->Transformed(/*L*/(Floc * TFloc).Transformation()));// eap occ332
+ //on projette Cref sur ce plan
Handle(GeomAdaptor_Surface) GAHS = new GeomAdaptor_Surface(P);
// Dub - Normalement myHCurve est une GeomAdaptor_Curve
Handle(GeomAdaptor_Curve) Gac = Handle(GeomAdaptor_Curve)::DownCast(myHCurve);
Handle(Geom_Curve) C3d = Gac->Curve();
- Handle(Geom_Curve) ProjOnPlane =
- GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,First,Last),
- P, P->Position().Direction(),
- Standard_True);
+ Handle(Geom_Curve) ProjOnPlane =
+ GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,First,Last),
+ P, P->Position().Direction(),
+ Standard_True);
Handle(GeomAdaptor_Curve) aHCurve =
new GeomAdaptor_Curve(ProjOnPlane);
- ProjLib_ProjectedCurve proj(GAHS,aHCurve);
- Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
+ ProjLib_ProjectedCurve proj(GAHS,aHCurve);
+ Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
Handle(Geom2dAdaptor_Curve) GHPC =
new Geom2dAdaptor_Curve(PC,
- myHCurve->FirstParameter(),
- myHCurve->LastParameter());
-
- Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
+ myHCurve->FirstParameter(),
+ myHCurve->LastParameter());
+ Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
+
Standard_Boolean ok = Validate (*myHCurve, ACS, Tol,Standard_True); // voir dub...
- if (!ok) {
- BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
- }
- }
- }
+ if (!ok) {
+ BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
+ }
+ }
+ }
}
}
break;
Standard_Integer nbconnection = 0;
//TopExp_Explorer exp;
for (exp.Init(S,TopAbs_FACE); exp.More(); exp.Next()) {
- const TopoDS_Face& fac = TopoDS::Face(exp.Current());
- TopExp_Explorer exp2;
- for (exp2.Init(fac,TopAbs_EDGE); exp2.More(); exp2.Next()) {
- if (exp2.Current().IsSame(myShape)) {
- nbconnection++;
- }
- }
+ const TopoDS_Face& fac = TopoDS::Face(exp.Current());
+ TopExp_Explorer exp2;
+ for (exp2.Init(fac,TopAbs_EDGE); exp2.More(); exp2.Next()) {
+ if (exp2.Current().IsSame(myShape)) {
+ nbconnection++;
+ }
+ }
}
if (nbconnection < 2 && !TE->Degenerated()) {
- BRepCheck::Add(myMap(S),BRepCheck_FreeEdge);
+ BRepCheck::Add(myMap(S),BRepCheck_FreeEdge);
}
else if (nbconnection > 2) {
- BRepCheck::Add(myMap(S),BRepCheck_InvalidMultiConnexity);
+ BRepCheck::Add(myMap(S),BRepCheck_InvalidMultiConnexity);
}
else {
- BRepCheck::Add(myMap(S),BRepCheck_NoError);
+ BRepCheck::Add(myMap(S),BRepCheck_NoError);
}
}
break;
void BRepCheck_Edge::Blind()
{
- // Modified by skv - Tue Apr 27 11:36:01 2004 Begin
- // The body of this function is removed because of its useless.
+// Modified by skv - Tue Apr 27 11:36:01 2004 Begin
+// The body of this function is removed because of its useless.
if (!myBlind) {
myBlind = Standard_True;
}
- // Modified by skv - Tue Apr 27 11:36:02 2004 End
+// Modified by skv - Tue Apr 27 11:36:02 2004 End
}
//function : SetStatus
//purpose :
//=======================================================================
+
void BRepCheck_Edge::SetStatus(const BRepCheck_Status theStatus)
{
- BRepCheck::Add(myMap(myShape),theStatus);
+ BRepCheck::Add(myMap(myShape),theStatus);
}
+
//=======================================================================
//function : Tolerance
//purpose :
//// modified by jgv, 20.03.03 ////
TopLoc_Location Loc = myShape.Location() * cr->Location();
Handle(Geom_Curve) C3d = Handle(Geom_Curve)::DownCast
- (cr->Curve3D()->Transformed( Loc.Transformation() ));
+ (cr->Curve3D()->Transformed( Loc.Transformation() ));
///////////////////////////////////
GeomAdaptor_Curve GAC3d(C3d,First,Last);
it=iRep;
if (iRep>1) {
- theRep(iRep)=theRep(1);
- it=1;
+ theRep(iRep)=theRep(1);
+ it=1;
}
theRep(it) = new GeomAdaptor_Curve(GAC3d);
iRep++;
else if (cr->IsCurveOnSurface()) {
{
Handle(Geom_Surface) Sref = cr->Surface();
- //// modified by jgv, 20.03.03 ////
- TopLoc_Location Loc = myShape.Location() * cr->Location();
+ //// modified by jgv, 20.03.03 ////
+ TopLoc_Location Loc = myShape.Location() * cr->Location();
Sref = Handle(Geom_Surface)::DownCast
(Sref->Transformed( Loc.Transformation() ));
- ///////////////////////////////////
+ ///////////////////////////////////
const Handle(Geom2d_Curve)& PCref = cr->PCurve();
Handle(GeomAdaptor_Surface) GAHSref = new GeomAdaptor_Surface(Sref);
Handle(Geom2dAdaptor_Curve) GHPCref =
iRep++;
}
if (cr->IsCurveOnClosedSurface()) {
- Handle(Geom_Surface) Sref = cr->Surface();
- Sref = Handle(Geom_Surface)::DownCast
- (Sref->Transformed(cr->Location().Transformation()));
- const Handle(Geom2d_Curve)& PCref = cr->PCurve2();
+ Handle(Geom_Surface) Sref = cr->Surface();
+ Sref = Handle(Geom_Surface)::DownCast
+ (Sref->Transformed(cr->Location().Transformation()));
+ const Handle(Geom2d_Curve)& PCref = cr->PCurve2();
Handle(GeomAdaptor_Surface) GAHSref = new GeomAdaptor_Surface(Sref);
Handle(Geom2dAdaptor_Curve) GHPCref =
new Geom2dAdaptor_Curve(PCref,First,Last);
- Adaptor3d_CurveOnSurface ACSref(GHPCref,GAHSref);
+ Adaptor3d_CurveOnSurface ACSref(GHPCref,GAHSref);
theRep(iRep) = new Adaptor3d_CurveOnSurface(ACSref);
- iRep++;
- nbRep++;
+ iRep++;
+ nbRep++;
}
}
else {
return BRepCheck_NoError;
}
+//=======================================================================
+//function : CheckTolerance
+//purpose : Cheks, if theEdge lies entirely into sphere, center of which
+// is middle point of line segment, which joins first and last
+// vertex of an edge, and radius is aTol (see function's body).
+//=======================================================================
+BRepCheck_Status BRepCheck_Edge::CheckTolerance(const TopoDS_Edge& theEdge)
+{
+ BRepCheck_Status aStatus = BRepCheck_NoError;
+ Standard_Real aTol1 = 1.0e-7, aTol2 = 1.0e-7;
+
+ if(BRep_Tool::Degenerated(theEdge))
+ {
+ aStatus = BRepCheck_NoError;
+ return aStatus;
+ }
+
+ TopoDS_Vertex aV1 = TopExp::FirstVertex(theEdge),
+ aV2 = TopExp::LastVertex(theEdge);
+
+ if(aV2.IsNull() || aV1.IsNull())
+ {
+ aStatus = BRepCheck_NoError;
+ return aStatus;
+ }
+
+ gp_Pnt aPnt1, aPnt2;
+
+ aPnt1 = BRep_Tool::Pnt(aV1);
+ aPnt2 = BRep_Tool::Pnt(aV2);
+
+ aTol1 = BRep_Tool::Tolerance(aV1);
+ aTol2 = BRep_Tool::Tolerance(aV2);
+
+ if( Precision::IsInfinite(aTol1) ||
+ Precision::IsInfinite(aTol2))
+ {
+ aStatus = BRepCheck_CollapsedEdge;
+ return aStatus;
+ }
+
+ Standard_Real st = aTol1 + aTol2;
+
+ if(aPnt1.SquareDistance(aPnt2) >= st*st)
+ {
+ aStatus = BRepCheck_NoError;
+ return aStatus;
+ }
+
+ gp_Pnt aPn( (aPnt1.X() + aPnt2.X())/2.0,
+ (aPnt1.Y() + aPnt2.Y())/2.0,
+ (aPnt1.Z() + aPnt2.Z())/2.0);
+
+
+ const Standard_Real aTol = Max(aTol1,aTol2) + aPnt1.Distance(aPnt2)/2.0;
+ const Standard_Real aTols = aTol*aTol;
+
+ BRepAdaptor_Curve BACurve(theEdge);
+
+ const Standard_Real aFirst = BACurve.FirstParameter(),
+ aLast = BACurve.LastParameter();
+
+ const Standard_Real dParam = aLast - aFirst;
+
+ for(Standard_Integer i = 0; i < maxNIter; i++)
+ {
+ const Standard_Real ParOnC = aFirst + DivPoints[i]*dParam;
+
+ gp_Pnt pt = BACurve.Value(ParOnC);
+ if((aPn.SquareDistance(pt) >= aTols))
+ {
+ aStatus = BRepCheck_NoError;
+ return aStatus;
+ }
+ }
+
+ aStatus = BRepCheck_CollapsedEdge;
+ return aStatus;
+}
+
//=======================================================================
//function : Validate
//purpose :
//=======================================================================
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
- const Adaptor3d_CurveOnSurface& Other,
- const Standard_Real Tol,
- const Standard_Boolean SameParameter)
+ const Adaptor3d_CurveOnSurface& Other,
+ const Standard_Real Tol,
+ const Standard_Boolean SameParameter)
{
Standard_Boolean Status, proj;
Standard_Real aPC, First, Last, Error;
Tol2=Tol2*Tol2;
//Tol2=Tol*Tol;
//modified by NIZNHY-PKV Thu May 05 09:06:47 2011t
-
+
for (i = 0; i < NCONTROL; ++i) {
prm = ((NCONTROL-1-i)*First + i*Last)/(NCONTROL-1);
pref = CRef.Value(prm);
pother = Other.Value(prm);
if (pref.SquareDistance(pother) > Tol2) {
- problematic_point = pref ;
- Status = Standard_False;
- Error = pref.Distance(pother);
- PrintProblematicPoint(problematic_point, Error, Tol);
- return Status;
+ problematic_point = pref ;
+ Status = Standard_False;
+ Error = pref.Distance(pother);
+ PrintProblematicPoint(problematic_point, Error, Tol);
+ return Status;
//goto FINISH ;
}
}
gp_Pnt pother = Other.Value(oprm);
refd.Perform(pother,rprm);
if (!refd.IsDone() || refd.SquareDistance() > Tol * Tol) {
- problematic_point = pref ;
- Status = Standard_False ;
- if (refd.IsDone()) {
- Error = sqrt (refd.SquareDistance());
- }
- else {
- Error = RealLast();
- }
- PrintProblematicPoint(problematic_point, Error, Tol);
- return Status;
+ problematic_point = pref ;
+ Status = Standard_False ;
+ if (refd.IsDone()) {
+ Error = sqrt (refd.SquareDistance());
+ }
+ else {
+ Error = RealLast();
+ }
+ PrintProblematicPoint(problematic_point, Error, Tol);
+ return Status;
//goto FINISH ;
}
otherd.Perform(pref,oprm);
if (!otherd.IsDone() || otherd.SquareDistance() > Tol * Tol) {
- problematic_point = pref ;
- Status = Standard_False ;
- if (otherd.IsDone()) {
- Error = sqrt (otherd.SquareDistance());
- }
- else {
- Error = RealLast();
- }
- PrintProblematicPoint(problematic_point, Error, Tol);
- return Status;
- //goto FINISH ;
+ problematic_point = pref ;
+ Status = Standard_False ;
+ if (otherd.IsDone()) {
+ Error = sqrt (otherd.SquareDistance());
+ }
+ else {
+ Error = RealLast();
+ }
+ PrintProblematicPoint(problematic_point, Error, Tol);
+ return Status;
+ //goto FINISH ;
}
}
}
return Status ;
-
+
}
//=======================================================================
//purpose :
//=======================================================================
Standard_Real Prec(const Adaptor3d_Curve& aAC3D,
- const Adaptor3d_CurveOnSurface& aACS)
+ const Adaptor3d_CurveOnSurface& aACS)
{
Standard_Real aXEmax, aXC, aXS;
const Handle(Adaptor3d_Surface)& aAHS = aACS.GetSurface();
//
aXC = BRepCheck::PrecCurve(aAC3D);
aXS = BRepCheck::PrecSurface(aAHS);
- aXEmax = (aXC>aXS) ? aXC: aXS;
+ aXEmax=(aXC>aXS) ? aXC: aXS;
return aXEmax;
}
//=======================================================================
#ifdef OCCT_DEBUG
void PrintProblematicPoint(const gp_Pnt& problematic_point,
- const Standard_Real Error,
- const Standard_Real Tol)
+ const Standard_Real Error,
+ const Standard_Real Tol)
{
std::cout << " **** probleme de SameParameter au point :" << std::endl;
std::cout << " " << problematic_point.Coord(1) << " "
}
#else
void PrintProblematicPoint(const gp_Pnt&,
- const Standard_Real,
- const Standard_Real)
+ const Standard_Real,
+ const Standard_Real)
{
}
#endif
static void FillProblems(const BRepCheck_Status stat,
Handle(TColStd_HArray1OfInteger)& NbProblems)
{
+ case BRepCheck_CollapsedEdge:
+ NbProblems->SetValue(13,NbProblems->Value(13)+1); break;
+ NbProblems->SetValue(14,NbProblems->Value(14)+1); break;
+ NbProblems->SetValue(15,NbProblems->Value(15)+1); break;
+ NbProblems->SetValue(16,NbProblems->Value(16)+1); break;
+ NbProblems->SetValue(17,NbProblems->Value(17)+1); break;
+ NbProblems->SetValue(18,NbProblems->Value(18)+1); break;
+ NbProblems->SetValue(19,NbProblems->Value(19)+1); break;
+ NbProblems->SetValue(20,NbProblems->Value(20)+1); break;
+ NbProblems->SetValue(21,NbProblems->Value(21)+1); break;
+ NbProblems->SetValue(22,NbProblems->Value(22)+1); break;
+ NbProblems->SetValue(23,NbProblems->Value(23)+1); break;
+ NbProblems->SetValue(24,NbProblems->Value(24)+1); break;
+ NbProblems->SetValue(25,NbProblems->Value(25)+1); break;
+ NbProblems->SetValue(26,NbProblems->Value(26)+1); break;
+ NbProblems->SetValue(27,NbProblems->Value(27)+1); break;
+ NbProblems->SetValue(28,NbProblems->Value(28)+1); break;
+ NbProblems->SetValue(29,NbProblems->Value(29)+1); break;
+ NbProblems->SetValue(30,NbProblems->Value(30)+1); break;
+ NbProblems->SetValue(31,NbProblems->Value(31)+1); break;
+ NbProblems->SetValue(32,NbProblems->Value(32)+1); break;
+ case BRepCheck_InvalidToleranceValue:
+ NbProblems->SetValue(33,NbProblems->Value(33)+1); break;
+ case BRepCheck_CheckFail:
+ NbProblems->SetValue(34,NbProblems->Value(34)+1); break;
const Standard_Integer anID = static_cast<Standard_Integer> (stat);
NbProblems->SetValue(anID, NbProblems->Value(anID)+1);
-}
+ }
//=======================================================================
GetProblemShapes(theAna, theShape, sl, NbProblems);
theMap.Clear();
+ if(NbProblems->Value(13)>0)
+ theCommands<<" Edge is collapsed in vertex............... "<<NbProblems->Value(13)<<"\n";
+ //cout<<" Invalid Degenerated Flag ................. "<<NbProblems->Value(12)<<endl;
+ if(NbProblems->Value(14)>0)
+ theCommands<<" Free Edge ................................ "<<NbProblems->Value(14)<<"\n";
+ //cout<<" Free Edge ................................ "<<NbProblems->Value(14)<<endl;
+ if(NbProblems->Value(15)>0)
+ theCommands<<" Invalid MultiConnexity ................... "<<NbProblems->Value(15)<<"\n";
+ //cout<<" Invalid MultiConnexity ................... "<<NbProblems->Value(15)<<endl;
+ if(NbProblems->Value(16)>0)
+ theCommands<<" Invalid Range ............................ "<<NbProblems->Value(16)<<"\n";
+ //cout<<" Invalid Range ............................ "<<NbProblems->Value(16)<<endl;
+ if(NbProblems->Value(17)>0)
+ theCommands<<" Empty Wire ............................... "<<NbProblems->Value(17)<<"\n";
+ //cout<<" Empty Wire ............................... "<<NbProblems->Value(17)<<endl;
+ if(NbProblems->Value(18)>0)
+ theCommands<<" Redundant Edge ........................... "<<NbProblems->Value(18)<<"\n";
+ //cout<<" Redundant Edge ........................... "<<NbProblems->Value(18)<<endl;
+ if(NbProblems->Value(19)>0)
+ theCommands<<" Self Intersecting Wire ................... "<<NbProblems->Value(19)<<"\n";
+ //cout<<" Self Intersecting Wire ................... "<<NbProblems->Value(19)<<endl;
+ if(NbProblems->Value(20)>0)
+ theCommands<<" No Surface ............................... "<<NbProblems->Value(20)<<"\n";
+ //cout<<" No Surface ............................... "<<NbProblems->Value(20)<<endl;
+ if(NbProblems->Value(21)>0)
+ theCommands<<" Invalid Wire ............................. "<<NbProblems->Value(21)<<"\n";
+ //cout<<" Invalid Wire ............................. "<<NbProblems->Value(21)<<endl;
+ if(NbProblems->Value(22)>0)
+ theCommands<<" Redundant Wire ........................... "<<NbProblems->Value(22)<<"\n";
+ //cout<<" Redundant Wire ........................... "<<NbProblems->Value(22)<<endl;
+ if(NbProblems->Value(23)>0)
+ theCommands<<" Intersecting Wires ....................... "<<NbProblems->Value(23)<<"\n";
+ //cout<<" Intersecting Wires ....................... "<<NbProblems->Value(23)<<endl;
+ if(NbProblems->Value(24)>0)
+ theCommands<<" Invalid Imbrication of Wires ............. "<<NbProblems->Value(24)<<"\n";
+ //cout<<" Invalid Imbrication of Wires ............. "<<NbProblems->Value(24)<<endl;
+ if(NbProblems->Value(25)>0)
+ theCommands<<" Empty Shell .............................. "<<NbProblems->Value(25)<<"\n";
+ //cout<<" Empty Shell .............................. "<<NbProblems->Value(25)<<endl;
+ if(NbProblems->Value(26)>0)
+ theCommands<<" Redundant Face ........................... "<<NbProblems->Value(26)<<"\n";
+ //cout<<" Redundant Face ........................... "<<NbProblems->Value(26)<<endl;
+ if(NbProblems->Value(27)>0)
+ theCommands<<" Unorientable Shape ....................... "<<NbProblems->Value(27)<<"\n";
+ //cout<<" Unorientable Shape ....................... "<<NbProblems->Value(27)<<endl;
+ if(NbProblems->Value(28)>0)
+ theCommands<<" Not Closed ............................... "<<NbProblems->Value(28)<<"\n";
+ //cout<<" Not Closed ............................... "<<NbProblems->Value(28)<<endl;
+ if(NbProblems->Value(29)>0)
+ theCommands<<" Not Connected ............................ "<<NbProblems->Value(29)<<"\n";
+ //cout<<" Not Connected ............................ "<<NbProblems->Value(29)<<endl;
+ if(NbProblems->Value(30)>0)
+ theCommands<<" Subshape not in Shape .................... "<<NbProblems->Value(30)<<"\n";
+ //cout<<" Subshape not in Shape .................... "<<NbProblems->Value(30)<<endl;
+ if(NbProblems->Value(31)>0)
+ theCommands<<" Bad Orientation .......................... "<<NbProblems->Value(31)<<"\n";
+ //cout<<" Bad Orientation .......................... "<<NbProblems->Value(31)<<endl;
+ if(NbProblems->Value(32)>0)
+ theCommands<<" Bad Orientation of Subshape .............. "<<NbProblems->Value(32)<<"\n";
+ //cout<<" Bad Orientation of Subshape .............. "<<NbProblems->Value(32)<<endl;
+ if(NbProblems->Value(33)>0)
+ theCommands<<" Invalid tolerance value................... "<<NbProblems->Value(33)<<"\n";
+ //cout<<" checkshape failure......... .............. "<<NbProblems->Value(33)<<endl;
+ if(NbProblems->Value(34)>0)
+ theCommands<<" checkshape failure......... .............. "<<NbProblems->Value(34)<<"\n";
+ //cout<<" checkshape failure......... .............. "<<NbProblems->Value(34)<<endl;
Standard_Integer aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidPointOnCurve);
if(NbProblems->Value(aProblemID) > 0)
theCommands<<" Invalid Point on Curve ................... "<<NbProblems->Value(aProblemID)<<"\n";
+ if(NbProblems->Value(34)>0)
+ theCommands<<" checkshape failure........................ "<<NbProblems->Value(34)<<"\n";
+ //cout<<" checkshape failure......... .............. "<<NbProblems->Value(32)<<endl;
aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidPointOnCurveOnSurface);
if(NbProblems->Value(aProblemID)>0)
face1=TopoDS::Face(It.Value());
It.Next();
face2=TopoDS::Face(It.Value());
-
+
Standard_Boolean IsSeam = face1.IsEqual(face2);
// calcul des deux pcurves
{
case 7 : epsG1 = Draw::Atof(a[6]);
Standard_FALLTHROUGH
- case 6 : epsC0 = Draw::Atof(a[5]);
+ case 6 : epsC0 = Draw::Atof(a[5]);
Standard_FALLTHROUGH
- case 5 : epsnl = Draw::Atof(a[4]);
+ case 5 : epsnl = Draw::Atof(a[4]);
Standard_FALLTHROUGH
case 4 : break;
- default : return 1;
- }
+ default : return 1;
+ }
Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;
{
case 6 : epsC0 = Draw::Atof(a[5]);
Standard_FALLTHROUGH
- case 5 : epsnl = Draw::Atof(a[4]);
+ case 5 : epsnl = Draw::Atof(a[4]);
Standard_FALLTHROUGH
case 4 : break;
- default : return 1;
- }
+ default : return 1;
+ }
Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;
Standard_Boolean isconti = Standard_True;
nbeval = (Standard_Integer ) Draw::Atof( a[3]);
switch(n)
- {
- case 9 : maxlen = Draw::Atof(a[8]);
+ {
+ case 9 : maxlen = Draw::Atof(a[8]);
Standard_FALLTHROUGH
- case 8 : percent = Draw::Atof(a[7]);
+ case 8 : percent = Draw::Atof(a[7]);
Standard_FALLTHROUGH
- case 7 : epsG1 = Draw::Atof(a[6]);
+ case 7 : epsG1 = Draw::Atof(a[6]);
Standard_FALLTHROUGH
- case 6 : epsC0 = Draw::Atof(a[5]);
+ case 6 : epsC0 = Draw::Atof(a[5]);
Standard_FALLTHROUGH
- case 5 : epsnl = Draw::Atof(a[4]);
+ case 5 : epsnl = Draw::Atof(a[4]);
Standard_FALLTHROUGH
case 4 : break;
- default : return 1;
- }
+ default : return 1;
+ }
Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;