From fd87d80b238f5cdfbdab2a342ed4fbdee2226b4c Mon Sep 17 00:00:00 2001 From: ifv Date: Fri, 11 Sep 2015 14:01:45 +0300 Subject: [PATCH] 0026651: IntTools_FClass2d gives incorrect result of classification --- src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx | 31 +++++++++++++++++++-- tests/de/step_3/E6 | 2 +- tests/de/step_4/B7 | 2 +- tests/de/step_5/A1 | 4 +-- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx b/src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx index 8e7c84c149..f17a951db5 100644 --- a/src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx +++ b/src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx @@ -40,7 +40,19 @@ Standard_Integer Geom2dInt_Geom2dCurveTool::NbSamples (const Adaptor2d_Curve2d& nbs*= C.Degree(); Standard_Real anb = t1/t * nbs; nbs = (Standard_Integer)anb; - if(nbs < 4.0) nbs=4; + if(nbs < 4) nbs=4; + } + else if (typC == GeomAbs_Circle) + { + //Try to reach deflection = eps*R, eps = 0.01 + const Standard_Real minR = 1.; //eps = 0.01 + Standard_Real R = C.Circle().Radius(); + if(R > minR) + { + Standard_Real angl = 0.283079; //2.*ACos(1. - eps); + Standard_Integer n = RealToInt(Abs(U1 - U0) / angl); + nbs = Max(n, nbs); + } } if(nbs>300) @@ -50,7 +62,22 @@ Standard_Integer Geom2dInt_Geom2dCurveTool::NbSamples (const Adaptor2d_Curve2d& } //============================================================ Standard_Integer Geom2dInt_Geom2dCurveTool::NbSamples (const Adaptor2d_Curve2d& C) { - return C.NbSamples(); + Standard_Integer nbs = C.NbSamples(); + GeomAbs_CurveType typC = C.GetType(); + if (typC == GeomAbs_Circle) + { + //Try to reach deflection = eps*R, eps = 0.01 + const Standard_Real minR = 1.; //eps = 0.01 + Standard_Real R = C.Circle().Radius(); + if(R > minR) + { + Standard_Real angl = 0.283079; //2.*ACos(1. - eps); + Standard_Integer n = RealToInt((C.LastParameter()-C.FirstParameter()) / angl); + nbs = Max(n, nbs); + } + } + + return nbs; } diff --git a/tests/de/step_3/E6 b/tests/de/step_3/E6 index a988b1f0f3..482157e563 100755 --- a/tests/de/step_3/E6 +++ b/tests/de/step_3/E6 @@ -8,7 +8,7 @@ set filename Z8M6SAT.stp set ref_data { DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 ) TPSTAT : Faulties = 3 ( 0 ) Warnings = 944 ( 3168 ) Summary = 947 ( 3168 ) -CHECKSHAPE : Wires = 50 ( 41 ) Faces = 50 ( 46 ) Shells = 0 ( 2 ) Solids = 0 ( 0 ) +CHECKSHAPE : Wires = 50 ( 41 ) Faces = 50 ( 48 ) Shells = 0 ( 2 ) Solids = 0 ( 0 ) NBSHAPES : Solid = 28 ( 28 ) Shell = 768 ( 30 ) Face = 3240 ( 3239 ) Summary = 29376 ( 28630 ) STATSHAPE : Solid = 28 ( 28 ) Shell = 768 ( 30 ) Face = 3240 ( 3239 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 12588 ( 12579 ) TOLERANCE : MaxTol = 15.00300076 ( 20.46526799 ) AvgTol = 0.02278114498 ( 0.03744892177 ) diff --git a/tests/de/step_4/B7 b/tests/de/step_4/B7 index d8e3e17301..aac8203442 100644 --- a/tests/de/step_4/B7 +++ b/tests/de/step_4/B7 @@ -4,7 +4,7 @@ set filename Z1MDT6.stp set ref_data { DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 ) TPSTAT : Faulties = 0 ( 0 ) Warnings = 29 ( 195 ) Summary = 29 ( 195 ) -CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 1 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) +CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 2 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) NBSHAPES : Solid = 2 ( 2 ) Shell = 2 ( 2 ) Face = 372 ( 372 ) Summary = 2869 ( 2869 ) STATSHAPE : Solid = 3 ( 3 ) Shell = 3 ( 3 ) Face = 384 ( 384 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 1244 ( 1244 ) TOLERANCE : MaxTol = 0.0007170960464 ( 0.0007171032164 ) AvgTol = 1.914460687e-005 ( 2.129229514e-005 ) diff --git a/tests/de/step_5/A1 b/tests/de/step_5/A1 index 0cdceff1f6..1d65d1adcb 100755 --- a/tests/de/step_5/A1 +++ b/tests/de/step_5/A1 @@ -6,10 +6,10 @@ set filename Z8INV5.stp set ref_data { DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 ) TPSTAT : Faulties = 0 ( 0 ) Warnings = 114 ( 619 ) Summary = 114 ( 619 ) -CHECKSHAPE : Wires = 17 ( 17 ) Faces = 19 ( 19 ) Shells = 1 ( 1 ) Solids = 0 ( 0 ) +CHECKSHAPE : Wires = 17 ( 17 ) Faces = 19 ( 20 ) Shells = 1 ( 1 ) Solids = 0 ( 0 ) NBSHAPES : Solid = 22 ( 22 ) Shell = 24 ( 24 ) Face = 1521 ( 1520 ) Summary = 11216 ( 11206 ) STATSHAPE : Solid = 22 ( 22 ) Shell = 24 ( 24 ) Face = 1521 ( 1520 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 4785 ( 4781 ) -TOLERANCE : MaxTol = 12.54913924 ( 7.159520237 ) AvgTol = 0.04320092698 ( 0.0322263844 ) +TOLERANCE : MaxTol = 7.33063502 ( 7.159520237 ) AvgTol = 0.03499829069 ( 0.03222638333 ) LABELS : N0Labels = 25 ( 25 ) N1Labels = 23 ( 23 ) N2Labels = 0 ( 0 ) TotalLabels = 48 ( 48 ) NameLabels = 48 ( 48 ) ColorLabels = 0 ( 0 ) LayerLabels = 0 ( 0 ) PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 ) NCOLORS : NColors = 0 ( 0 )