diff --git a/src/HLRBRep/HLRBRep_CurveTool.cxx b/src/HLRBRep/HLRBRep_CurveTool.cxx index e8241b177c..49706e1cfc 100644 --- a/src/HLRBRep/HLRBRep_CurveTool.cxx +++ b/src/HLRBRep/HLRBRep_CurveTool.cxx @@ -60,8 +60,8 @@ HLRBRep_CurveTool::NbSamples (const Standard_Address C) Standard_Integer HLRBRep_CurveTool::NbSamples (const Standard_Address C, - const Standard_Real /*u1*/, - const Standard_Real /*u2*/) + const Standard_Real u1, + const Standard_Real u2) { GeomAbs_CurveType typC = ((HLRBRep_Curve *)C)->GetType(); static Standard_Real nbsOther = 10.0; @@ -72,7 +72,9 @@ HLRBRep_CurveTool::NbSamples (const Standard_Address C, else if(typC == GeomAbs_BezierCurve) nbs = 3 + ((HLRBRep_Curve *)C)->NbPoles(); else if(typC == GeomAbs_BSplineCurve) { - nbs = ((HLRBRep_Curve *)C)->NbKnots(); + Handle(Geom_Curve) aCurve = ((HLRBRep_Curve *)C)->Curve().Curve().Curve(); + GeomAdaptor_Curve GAcurve(aCurve, u1, u2); + nbs = GAcurve.NbIntervals(GeomAbs_CN) + 1; nbs*= ((HLRBRep_Curve *)C)->Degree(); if(nbs < 2.0) nbs=2; } diff --git a/src/HLRBRep/HLRBRep_Data.cxx b/src/HLRBRep/HLRBRep_Data.cxx index 8a4d2927bb..a895b812ae 100644 --- a/src/HLRBRep/HLRBRep_Data.cxx +++ b/src/HLRBRep/HLRBRep_Data.cxx @@ -774,7 +774,7 @@ void HLRBRep_Data::Update (const HLRAlgo_Projector& P) Standard_Boolean withOutL = Standard_False; for (myFaceItr1.InitEdge(*fd); - myFaceItr1.MoreEdge() && !cut && !withOutL; + myFaceItr1.MoreEdge(); myFaceItr1.NextEdge()) { if (myFaceItr1.Internal()) { withOutL = Standard_True; diff --git a/src/HLRBRep/HLRBRep_Intersector.cxx b/src/HLRBRep/HLRBRep_Intersector.cxx index 96a6621d5a..c1ce1a7147 100644 --- a/src/HLRBRep/HLRBRep_Intersector.cxx +++ b/src/HLRBRep/HLRBRep_Intersector.cxx @@ -118,7 +118,10 @@ void HLRBRep_Intersector::Perform (const Standard_Address A1, b = ((HLRBRep_Curve*)myC1)->Parameter2d(b); IntRes2d_Domain D1(pa,a,(Standard_Real)ta,pb,b,(Standard_Real)tb); - tol = (Standard_Real)(((HLRBRep_EdgeData*) A1)->Tolerance()); + //modified by jgv, 18.04.2016 for OCC27341 + //tol = (Standard_Real)(((HLRBRep_EdgeData*) A1)->Tolerance()); + tol = Precision::Confusion(); + ////////////////////////////////////////// myIntersector.Perform(myC1,D1,tol,tol); } @@ -155,8 +158,12 @@ void HLRBRep_Intersector::Perform (const Standard_Integer /*nA*/, Standard_Real a1,b1,a2,b2,d,dd,tol,tol1,tol2; Standard_ShortReal ta,tb; - tol1 = (Standard_Real)(((HLRBRep_EdgeData*) A1)->Tolerance()); - tol2 = (Standard_Real)(((HLRBRep_EdgeData*) A2)->Tolerance()); + //modified by jgv, 18.04.2016 for OCC27341 + //tol1 = (Standard_Real)(((HLRBRep_EdgeData*) A1)->Tolerance()); + //tol2 = (Standard_Real)(((HLRBRep_EdgeData*) A2)->Tolerance()); + tol1 = Precision::Confusion(); + tol2 = Precision::Confusion(); + ////////////////////////////////////////// if (tol1 > tol2) tol = tol1; else tol = tol2; diff --git a/src/HLRTopoBRep/HLRTopoBRep_DSFiller.cxx b/src/HLRTopoBRep/HLRTopoBRep_DSFiller.cxx index 44beb38403..3237d0e24e 100644 --- a/src/HLRTopoBRep/HLRTopoBRep_DSFiller.cxx +++ b/src/HLRTopoBRep/HLRTopoBRep_DSFiller.cxx @@ -68,59 +68,6 @@ #define APPROX 1 -static Standard_Boolean IntLineRisesFromRegularity(const TopoDS_Edge& anIntLine, - const TopoDS_Edge& anEdge, - const TopoDS_Face&, - const TopTools_ListOfShape& aList) -{ - TopoDS_Vertex Ver [2]; - TopExp::Vertices(anIntLine, Ver[0], Ver[1]); - - //find min param and max param - Standard_Real MinPar = RealLast(), MaxPar = RealFirst(); - TopTools_ListIteratorOfListOfShape itl(aList); - for (; itl.More(); itl.Next()) - { - const TopoDS_Edge& anOutLine = TopoDS::Edge(itl.Value()); - Standard_Real aFirst, aLast; - BRep_Tool::Range(anOutLine, aFirst, aLast); - if (aFirst < MinPar) - MinPar = aFirst; - if (aLast > MaxPar) - MaxPar = aLast; - } - - Standard_Real theTol = BRep_Tool::Tolerance(anEdge); - Standard_Real ParamTol = Precision::Confusion(); - - Standard_Integer i, j; - for (i = 0; i < 2; i++) - { - BRepExtrema_ExtPC anExtPC(Ver[i], anEdge); - if (!anExtPC.IsDone()) - continue; - Standard_Integer NbExt = anExtPC.NbExt(); - if (NbExt == 0) - continue; - Standard_Integer jmin = 1; - for (j = 2; j <= NbExt; j++) - if (anExtPC.SquareDistance(j) < anExtPC.SquareDistance(jmin)) - jmin = j; - Standard_Real aDist = anExtPC.SquareDistance(jmin); - aDist = Sqrt(aDist); - if (aDist > theTol) - continue; - - Standard_Real theParam = anExtPC.Parameter(jmin); - if (theParam > MinPar + ParamTol && - theParam < MaxPar - ParamTol) - return Standard_True; - } - - return Standard_False; -} - - //======================================================================= //function : Insert //purpose : explore the faces and insert them @@ -507,50 +454,6 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/, } } } - - //jgv: correction of internal outlines: remove those that rise from middle of boundary outlines - TopTools_ListIteratorOfListOfShape itl(IntL); - while (itl.More()) - { - TopoDS_Edge anIntLine = TopoDS::Edge(itl.Value()); - Standard_Real found = Standard_False; - TopExp_Explorer Explo(F, TopAbs_EDGE); - for (; Explo.More(); Explo.Next()) - { - TopoDS_Edge anEdge = TopoDS::Edge(Explo.Current()); - if (!BRep_Tool::HasContinuity(anEdge)) - continue; - - TopLoc_Location RegLoc; - Standard_Real fpar, lpar; - Handle(Geom_Curve) RegCurve = BRep_Tool::Curve(anEdge, RegLoc, fpar, lpar); - TopTools_ListOfShape thelist; - TopTools_ListIteratorOfListOfShape itoutl(OutL); - for (; itoutl.More(); itoutl.Next()) - { - TopoDS_Edge anOutLine = TopoDS::Edge(itoutl.Value()); - TopLoc_Location aLoc; - Standard_Real aFirst, aLast; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anOutLine, aLoc, aFirst, aLast); - if (aCurve == RegCurve && aLoc == RegLoc) - thelist.Append(anOutLine); - } - - if (thelist.IsEmpty()) - continue; - - if (IntLineRisesFromRegularity(anIntLine, anEdge, F, thelist)) - { - IntL.Remove(itl); - found = Standard_True; - break; - } - } - - if (!found) - itl.Next(); - } - /////////////////////////////////////////////////// } //======================================================================= diff --git a/src/StdPrs/StdPrs_DeflectionCurve.cxx b/src/StdPrs/StdPrs_DeflectionCurve.cxx index 82083dc184..aa60e72070 100644 --- a/src/StdPrs/StdPrs_DeflectionCurve.cxx +++ b/src/StdPrs/StdPrs_DeflectionCurve.cxx @@ -174,12 +174,8 @@ static void drawCurve (Adaptor3d_Curve& aCurve, NumberOfPoints = Algo.NbPoints(); if (NumberOfPoints > 0) { - for (i=1;i<NumberOfPoints;i++) { + for (i = 1; i <= NumberOfPoints; i++) SeqP.Append(Algo.Value(i)); - } - if (j == nbinter) { - SeqP.Append(Algo.Value(NumberOfPoints)); - } } } } diff --git a/tests/bugs/modalg_5/bug23625_1 b/tests/bugs/modalg_5/bug23625_1 index a0f50a8ad4..2cf627eb53 100755 --- a/tests/bugs/modalg_5/bug23625_1 +++ b/tests/bugs/modalg_5/bug23625_1 @@ -15,8 +15,9 @@ fit reflectlines result a 0 1 0 -checkprops result -l 3730.32 -checkshape result +checkprops result -l 3882.71 +checkshape result checksection result +donly result checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_5/bug23625_2 b/tests/bugs/modalg_5/bug23625_2 index d7ac1c69e7..9d9fa86f33 100755 --- a/tests/bugs/modalg_5/bug23625_2 +++ b/tests/bugs/modalg_5/bug23625_2 @@ -15,8 +15,9 @@ fit reflectlines result a 0 1 0 -checkprops result -l 4022.72 +checkprops result -l 3905.95 checkshape result checksection result +donly result checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_5/bug23625_3 b/tests/bugs/modalg_5/bug23625_3 index 3c1a1abd69..6c94ae64ba 100755 --- a/tests/bugs/modalg_5/bug23625_3 +++ b/tests/bugs/modalg_5/bug23625_3 @@ -19,4 +19,5 @@ checkprops result -l 4843.56 checkshape result checksection result +donly result checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_5/bug23625_4 b/tests/bugs/modalg_5/bug23625_4 index 4edd6469e9..db4bea0e5d 100755 --- a/tests/bugs/modalg_5/bug23625_4 +++ b/tests/bugs/modalg_5/bug23625_4 @@ -19,4 +19,5 @@ checkprops result -l 4207.74 checkshape result checksection result +donly result checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_5/bug23625_5 b/tests/bugs/modalg_5/bug23625_5 index 04f03d7d26..db3372dc2b 100755 --- a/tests/bugs/modalg_5/bug23625_5 +++ b/tests/bugs/modalg_5/bug23625_5 @@ -19,4 +19,5 @@ checkprops result -l 6361.07 checkshape result checksection result +donly result checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_6/bug25908 b/tests/bugs/modalg_6/bug25908 index a08c5dd6ff..6e497b36ad 100755 --- a/tests/bugs/modalg_6/bug25908 +++ b/tests/bugs/modalg_6/bug25908 @@ -20,15 +20,15 @@ compound vl v1l vnl vol vil result set nbshapes_expected " Number of shapes in shape - VERTEX : 161 - EDGE : 81 + VERTEX : 167 + EDGE : 84 WIRE : 0 FACE : 0 SHELL : 0 SOLID : 0 COMPSOLID : 0 COMPOUND : 1 - SHAPE : 243 + SHAPE : 252 " checknbshapes result -ref ${nbshapes_expected} -t -m "HLRToShape" diff --git a/tests/bugs/modalg_6/bug27341 b/tests/bugs/modalg_6/bug27341 new file mode 100644 index 0000000000..e105f3722c --- /dev/null +++ b/tests/bugs/modalg_6/bug27341 @@ -0,0 +1,17 @@ +puts "============" +puts "OCC27341" +puts "============" +puts "" +###################################################### +# Incorrect exact HLR results +###################################################### + +restore [locate_data_file bug27341_hlrsave.brep] result + +vinit +vdisplay result +vfit +vhlr on +vhlrtype algo result + +checkview -screenshot -3d -path ${imagedir}/${test_image}.png