From 8233d063e2cec32f025e6374ddeeb7d68af388b2 Mon Sep 17 00:00:00 2001 From: san Date: Thu, 24 Sep 2015 17:46:07 +0300 Subject: [PATCH] 0026651: IntTools_FClass2d gives incorrect result of classification --- src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx | 29 ++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx b/src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx index 8e7c84c149..7cc20d6338 100644 --- a/src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx +++ b/src/Geom2dInt/Geom2dInt_Geom2dCurveTool.cxx @@ -42,6 +42,18 @@ Standard_Integer Geom2dInt_Geom2dCurveTool::NbSamples (const Adaptor2d_Curve2d& nbs = (Standard_Integer)anb; if(nbs < 4.0) 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) 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; } -- 2.39.5