diff --git a/src/BRepClass3d/BRepClass3d_SolidExplorer.cxx b/src/BRepClass3d/BRepClass3d_SolidExplorer.cxx index 99b60c99eb..051eac5f1e 100644 --- a/src/BRepClass3d/BRepClass3d_SolidExplorer.cxx +++ b/src/BRepClass3d/BRepClass3d_SolidExplorer.cxx @@ -247,13 +247,23 @@ Standard_Boolean BRepClass3d_SolidExplorer::PointInTheFace Standard_Real v,dv = (V2-V1)/6.0; if(du<1e-12) du=1e-12; if(dv<1e-12) dv=1e-12; + Standard_Boolean IsNotUper = !surf->IsUPeriodic(), IsNotVper = !surf->IsVPeriodic(); Standard_Integer NbPntCalc=0; if(myMapOfInter.IsBound(Face)) { void *ptr = (void*)(myMapOfInter.Find(Face)); + Standard_Boolean IsInside = Standard_True; + if(IsNotUper) + { + IsInside = (u_ >= U1) && (u_ <= U2); + } + if(IsNotVper) + { + IsInside &= (v_ >= V1) && (v_ <= V2); + } if(ptr) { const IntCurvesFace_Intersector& TheIntersector = (*((IntCurvesFace_Intersector *)ptr)); // Check if the point is already in the face - if(TheIntersector.ClassifyUVPoint(gp_Pnt2d(u_,v_))==TopAbs_IN) { + if(IsInside && (TheIntersector.ClassifyUVPoint(gp_Pnt2d(u_,v_))==TopAbs_IN)) { gp_Pnt aPnt; surf->D1(u_, v_, aPnt, theVecD1U, theVecD1V); if (aPnt.SquareDistance(APoint_) < Precision::Confusion() * Precision::Confusion()) @@ -429,6 +439,8 @@ Standard_Integer BRepClass3d_SolidExplorer::OtherSegment(const gp_Pnt& P, Standard_Integer IndexPoint=0; Standard_Integer NbPointsOK=0; Standard_Integer NbFacesInSolid=0; + Standard_Boolean aRestr = Standard_True; + Standard_Boolean aTestInvert = Standard_False; for(;;) { myFirstFace++; @@ -436,6 +448,7 @@ Standard_Integer BRepClass3d_SolidExplorer::OtherSegment(const gp_Pnt& P, // look for point on face starting from myFirstFace // Modified by skv - Thu Sep 4 14:31:12 2003 OCC578 Begin // while (faceexplorer.More()) { + NbFacesInSolid = 0; for (; faceexplorer.More(); faceexplorer.Next()) { // Modified by skv - Thu Sep 4 14:31:12 2003 OCC578 End NbFacesInSolid++; @@ -443,7 +456,26 @@ Standard_Integer BRepClass3d_SolidExplorer::OtherSegment(const gp_Pnt& P, face = TopoDS::Face(faceexplorer.Current()); Handle(BRepAdaptor_HSurface) surf = new BRepAdaptor_HSurface(); - surf->ChangeSurface().Initialize(face); + if(aTestInvert) + { + BRepTopAdaptor_FClass2d aClass(face, Precision::Confusion()); + if(aClass.PerformInfinitePoint() == TopAbs_IN) + { + aRestr = Standard_False; + if(myMapOfInter.IsBound(face)) + { + myMapOfInter.UnBind(face); + void *ptr = (void *)(new IntCurvesFace_Intersector(face, Precision::Confusion(), + aRestr)); + myMapOfInter.Bind(face,ptr); + } + } + else + { + aRestr = Standard_True; + } + } + surf->ChangeSurface().Initialize(face, aRestr); Standard_Real U1,V1,U2,V2; U1 = surf->FirstUParameter(); V1 = surf->FirstVParameter(); @@ -452,7 +484,10 @@ Standard_Integer BRepClass3d_SolidExplorer::OtherSegment(const gp_Pnt& P, face.Orientation(TopAbs_FORWARD); // //avoid process faces from uncorrected shells - if( Abs (U2 - U1) < 1.e-12 || Abs(V2 - V1) < 1.e-12) { + const Standard_Real eps = Precision::PConfusion(); + Standard_Real epsU = Max(eps * Max(Abs(U2), Abs(U1)), eps); + Standard_Real epsV = Max(eps * Max(Abs(V2), Abs(V1)), eps); + if( Abs (U2 - U1) < epsU || Abs(V2 - V1) < epsV) { return 2; } // @@ -622,6 +657,7 @@ Standard_Integer BRepClass3d_SolidExplorer::OtherSegment(const gp_Pnt& P, return 0; } } + aTestInvert = Standard_True; } //-- for(;;) { ... } } diff --git a/src/IntCurvesFace/IntCurvesFace_Intersector.cxx b/src/IntCurvesFace/IntCurvesFace_Intersector.cxx index 9b7d6be69f..a1bc4315e8 100644 --- a/src/IntCurvesFace/IntCurvesFace_Intersector.cxx +++ b/src/IntCurvesFace/IntCurvesFace_Intersector.cxx @@ -55,7 +55,8 @@ GeomAbs_SurfaceType IntCurvesFace_Intersector::SurfaceType() const //purpose : //======================================================================= IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face, - const Standard_Real aTol) + const Standard_Real aTol, + const Standard_Boolean aRestr) : Tol(aTol), done(Standard_False), @@ -65,7 +66,7 @@ IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face, { BRepAdaptor_Surface surface; face = Face; - surface.Initialize(Face,Standard_True); + surface.Initialize(Face, aRestr); Hsurface = new BRepAdaptor_HSurface(surface); myTopolTool = new BRepTopAdaptor_TopolTool(Hsurface); diff --git a/src/IntCurvesFace/IntCurvesFace_Intersector.hxx b/src/IntCurvesFace/IntCurvesFace_Intersector.hxx index f53346aa16..d853d39135 100644 --- a/src/IntCurvesFace/IntCurvesFace_Intersector.hxx +++ b/src/IntCurvesFace/IntCurvesFace_Intersector.hxx @@ -56,7 +56,11 @@ public: //! first point of the segment is near the face. In //! that case, the parameter of the intersection point //! on the line can be a negative value (greater than -Tol). - Standard_EXPORT IntCurvesFace_Intersector(const TopoDS_Face& F, const Standard_Real aTol); + //! If aRestr = true UV bounding box of face is used to restrict + //! it's underlined surface, + //! otherwise surface is not restricted + Standard_EXPORT IntCurvesFace_Intersector(const TopoDS_Face& F, const Standard_Real aTol, + const Standard_Boolean aRestr = Standard_True); //! Perform the intersection between the //! segment L and the loaded face. diff --git a/tests/boolean/gdml_private/T2 b/tests/boolean/gdml_private/T2 index d79c76bd0c..374516f43f 100644 --- a/tests/boolean/gdml_private/T2 +++ b/tests/boolean/gdml_private/T2 @@ -1,3 +1,3 @@ -puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_" +puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_" source [locate_data_file 20000_salle-experience.asm.4.gdml.tcl] diff --git a/tests/boolean/gdml_private/ZJ3 b/tests/boolean/gdml_private/ZJ3 index 1d235aad81..d7be5dc512 100644 --- a/tests/boolean/gdml_private/ZJ3 +++ b/tests/boolean/gdml_private/ZJ3 @@ -1,3 +1,3 @@ -puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_" +puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_" source [locate_data_file mos2014-po-modif.prt.1.gdml.tcl] diff --git a/tests/boolean/gdml_private/ZJ4 b/tests/boolean/gdml_private/ZJ4 index c134b6f50b..c514598ead 100644 --- a/tests/boolean/gdml_private/ZJ4 +++ b/tests/boolean/gdml_private/ZJ4 @@ -1,3 +1,3 @@ -puts "TODO OCC26018 ALL: Faulty shapes in variables faulty_1 to faulty_" +puts "TODO OCC26018 Windows: Faulty shapes in variables faulty_1 to faulty_" source [locate_data_file mos2014-po-modif.prt.15.gdml.tcl] diff --git a/tests/boolean/volumemaker/D4 b/tests/boolean/volumemaker/D4 index e66854d180..09f0aeadb4 100644 --- a/tests/boolean/volumemaker/D4 +++ b/tests/boolean/volumemaker/D4 @@ -47,5 +47,5 @@ mkface f8 cyl_f8 0 6.2831853071795862 -1000000 1000000 # make volume operation mkvolume result f1 f2 f3 f4 f5 f6 f7 f8 -set square 5.00014e+007 +set square 1.99784e+007 diff --git a/tests/bugs/modalg_6/bug26609 b/tests/bugs/modalg_6/bug26609 new file mode 100755 index 0000000000..6db990945d --- /dev/null +++ b/tests/bugs/modalg_6/bug26609 @@ -0,0 +1,21 @@ +puts "============" +puts "OCC26609" +puts "============" +puts "" +############################################################################ +# Wrong result obtained by solid classifier algorithm. +############################################################################ + +restore [locate_data_file bug26609_p.draw] p +restore [locate_data_file bug26609_z.brep] z + +set cls1 [bclassify z p] +if { [regexp {OUT} $cls1] } { + puts "Error : Wrong result obtained by solid classifier algorithm" +} else { + puts "OK : Good result obtained by solid classifier algorithm" +} + +smallview +fit +set only_screen_axo 1