Method BRepLib::SameParameter has been corrected to synchronize check of resulting tolerance with BRepCheck.
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Wire.hxx>
+#include <Adaptor3d_Curve.hxx>
+#include <Adaptor3d_HSurface.hxx>
+#include <GeomAbs_CurveType.hxx>
+#include <GeomAbs_SurfaceType.hxx>
+#include <gp_Elips.hxx>
//=======================================================================
//function : Add
}
lst.Append(stat);
}
+
//=======================================================================
//function : SelfIntersection
//purpose :
BRepCheck_Status stat = chkw->SelfIntersect(myFace,RetE1,RetE2);
return (stat == BRepCheck_SelfIntersectingWire);
}
+
+//=======================================================================
+//function : PrecCurve
+//purpose :
+//=======================================================================
+Standard_Real BRepCheck::PrecCurve(const Adaptor3d_Curve& aAC3D)
+{
+ Standard_Real aXEmax = RealEpsilon();
+ //
+ GeomAbs_CurveType aCT = aAC3D.GetType();
+ if (aCT==GeomAbs_Ellipse) {
+ Standard_Real aX[5];
+ //
+ gp_Elips aEL3D=aAC3D.Ellipse();
+ aEL3D.Location().Coord(aX[0], aX[1], aX[2]);
+ aX[3]=aEL3D.MajorRadius();
+ aX[4]=aEL3D.MinorRadius();
+ aXEmax=-1.;
+ for (Standard_Integer i = 0; i < 5; ++i) {
+ if (aX[i]<0.) {
+ aX[i]=-aX[i];
+ }
+ Standard_Real aXE = Epsilon(aX[i]);
+ if (aXE > aXEmax) {
+ aXEmax = aXE;
+ }
+ }
+ }//if (aCT=GeomAbs_Ellipse) {
+ //
+ return aXEmax;
+}
+
+//=======================================================================
+//function : PrecSurface
+//purpose :
+//=======================================================================
+Standard_Real BRepCheck::PrecSurface(const Handle(Adaptor3d_HSurface)& aAHSurf)
+{
+ Standard_Real aXEmax = RealEpsilon();
+ //
+ GeomAbs_SurfaceType aST = aAHSurf->GetType();
+ if (aST == GeomAbs_Cone) {
+ gp_Cone aCone=aAHSurf->Cone();
+ Standard_Real aX[4];
+ //
+ aCone.Location().Coord(aX[0], aX[1], aX[2]);
+ aX[3]=aCone.RefRadius();
+ aXEmax=-1.;
+ for (Standard_Integer i = 0; i < 4; ++i) {
+ if (aX[i] < 0.) {
+ aX[i] = -aX[i];
+ }
+ Standard_Real aXE = Epsilon(aX[i]);
+ if (aXE > aXEmax) {
+ aXEmax = aXE;
+ }
+ }
+ }//if (aST==GeomAbs_Cone) {
+ return aXEmax;
+}
+
//=======================================================================
//function : Print
//purpose :
class TopoDS_Wire;
class TopoDS_Face;
class TopoDS_Edge;
+class Adaptor3d_Curve;
+class Adaptor3d_HSurface;
class BRepCheck_Result;
class BRepCheck_Vertex;
class BRepCheck_Edge;
Standard_EXPORT static Standard_Boolean SelfIntersection (const TopoDS_Wire& W, const TopoDS_Face& F, TopoDS_Edge& E1, TopoDS_Edge& E2);
+ //! Returns the resolution on the 3d curve
+ Standard_EXPORT static Standard_Real PrecCurve(const Adaptor3d_Curve& aAC3D);
+
+ //! Returns the resolution on the surface
+ Standard_EXPORT static Standard_Real PrecSurface(const Handle(Adaptor3d_HSurface)& aAHSurf);
static
Standard_Real Prec(const Adaptor3d_Curve& aAC3D,
const Adaptor3d_CurveOnSurface& aACS);
-static
- Standard_Real PrecCurve(const Adaptor3d_Curve& aAC3D);
-static
- Standard_Real PrecSurface(const Adaptor3d_CurveOnSurface& aACS);
//static Standard_Boolean Validate(const Adaptor3d_Curve&,
// const Adaptor3d_Curve&,
return Status ;
}
+
//=======================================================================
//function : Prec
//purpose :
//=======================================================================
Standard_Real Prec(const Adaptor3d_Curve& aAC3D,
- const Adaptor3d_CurveOnSurface& aACS)
+ const Adaptor3d_CurveOnSurface& aACS)
{
Standard_Real aXEmax, aXC, aXS;
+ const Handle(Adaptor3d_HSurface)& aAHS = aACS.GetSurface();
//
- aXC=PrecCurve(aAC3D);
- aXS=PrecSurface(aACS);
- aXEmax=(aXC>aXS) ? aXC: aXS;
- return aXEmax;
-}
-//=======================================================================
-//function : PrecCurve
-//purpose :
-//=======================================================================
-Standard_Real PrecCurve(const Adaptor3d_Curve& aAC3D)
-{
- Standard_Real aXEmax;
- GeomAbs_CurveType aCT;
- //
- aXEmax=RealEpsilon();
- //
- aCT=aAC3D.GetType();
- if (aCT==GeomAbs_Ellipse) {
- Standard_Integer i;
- Standard_Real aX[5], aXE;
- //
- gp_Elips aEL3D=aAC3D.Ellipse();
- aEL3D.Location().Coord(aX[0], aX[1], aX[2]);
- aX[3]=aEL3D.MajorRadius();
- aX[4]=aEL3D.MinorRadius();
- aXEmax=-1.;
- for (i=0; i<5; ++i) {
- if (aX[i]<0.) {
- aX[i]=-aX[i];
- }
- aXE=Epsilon(aX[i]);
- if (aXE>aXEmax) {
- aXEmax=aXE;
- }
- }
- }//if (aCT=GeomAbs_Ellipse) {
- //
- return aXEmax;
-}
-//=======================================================================
-//function : PrecSurface
-//purpose :
-//=======================================================================
-Standard_Real PrecSurface(const Adaptor3d_CurveOnSurface& aACS)
-{
- Standard_Real aXEmax;
- GeomAbs_SurfaceType aST;
- //
- aXEmax=RealEpsilon();
- //
- const Handle(Adaptor3d_HSurface)& aAHS=aACS.GetSurface();
- aST=aAHS->GetType();
- if (aST==GeomAbs_Cone) {
- gp_Cone aCone=aAHS->Cone();
- Standard_Integer i;
- Standard_Real aX[4], aXE;
- //
- aCone.Location().Coord(aX[0], aX[1], aX[2]);
- aX[3]=aCone.RefRadius();
- aXEmax=-1.;
- for (i=0; i<4; ++i) {
- if (aX[i]<0.) {
- aX[i]=-aX[i];
- }
- aXE=Epsilon(aX[i]);
- if (aXE>aXEmax) {
- aXEmax=aXE;
- }
- }
- }//if (aST==GeomAbs_Cone) {
+ aXC = BRepCheck::PrecCurve(aAC3D);
+ aXS = BRepCheck::PrecSurface(aAHS);
+ aXEmax = (aXC>aXS) ? aXC: aXS;
return aXEmax;
}
+
//=======================================================================
//function : PrintProblematicPoint
//purpose :
#include <BRep_GCurve.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_ListOfCurveRepresentation.hxx>
+#include <BRepCheck.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_TFace.hxx>
#include <BRep_Tool.hxx>
}
GAC.Load(C3d,f3d,l3d);
+ Standard_Real Prec_C3d = BRepCheck::PrecCurve(GAC);
+
Standard_Boolean IsSameP = 1;
Standard_Real maxdist = 0.;
// Modified by skv - Thu Jun 3 12:39:19 2004 OCC5898 Begin
if (!IsSameP) {
- if (anEdgeTol >= error) {
+ Standard_Real Prec_Surf = BRepCheck::PrecSurface(HS);
+ Standard_Real CurTol = anEdgeTol + Max(Prec_C3d, Prec_Surf);
+ if (CurTol >= error) {
maxdist = Max(maxdist, anEdgeTol);
IsSameP = Standard_True;
}
--- /dev/null
+puts "=========================================================================="
+puts "OCC30363: BRepLib::SameParameter with option 'forced' corrupts valid shape"
+puts "=========================================================================="
+puts ""
+
+restore [locate_data_file bug30363_shell_3faces.brep] a
+checkshape a
+
+fsameparameter a 1.e-7
+checkshape a