diff --git a/src/IntTools/IntTools_EdgeEdge.cxx b/src/IntTools/IntTools_EdgeEdge.cxx index 6d212df5d4..83ec31e9c4 100644 --- a/src/IntTools/IntTools_EdgeEdge.cxx +++ b/src/IntTools/IntTools_EdgeEdge.cxx @@ -21,9 +21,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -1354,7 +1356,7 @@ Standard_Integer TypeToInteger(const GeomAbs_CurveType theCType) Standard_Real ResolutionCoeff(const BRepAdaptor_Curve& theBAC, const IntTools_Range& theRange) { - Standard_Real aResCoeff; + Standard_Real aResCoeff = 0.; // const Handle(Geom_Curve)& aCurve = theBAC.Curve().Curve(); const GeomAbs_CurveType aCurveType = theBAC.GetType(); @@ -1366,9 +1368,26 @@ Standard_Real ResolutionCoeff(const BRepAdaptor_Curve& theBAC, case GeomAbs_Ellipse : aResCoeff = 1. / Handle(Geom_Ellipse)::DownCast (aCurve)->MajorRadius(); break; + case GeomAbs_OffsetCurve : { + const Handle(Geom_OffsetCurve)& anOffsetCurve = Handle(Geom_OffsetCurve)::DownCast(aCurve); + const Handle(Geom_Curve)& aBasisCurve = anOffsetCurve->BasisCurve(); + const GeomAbs_CurveType aBCType = GeomAdaptor_Curve(aBasisCurve).GetType(); + if (aBCType == GeomAbs_Line) { + break; + } + else if (aBCType == GeomAbs_Circle) { + aResCoeff = 1. / (2 * (anOffsetCurve->Offset() + + Handle(Geom_Circle)::DownCast (aBasisCurve)->Circ().Radius())); + break; + } + else if (aBCType == GeomAbs_Ellipse) { + aResCoeff = 1. / (anOffsetCurve->Offset() + + Handle(Geom_Ellipse)::DownCast (aBasisCurve)->MajorRadius()); + break; + } + } case GeomAbs_Hyperbola : case GeomAbs_Parabola : - case GeomAbs_OffsetCurve : case GeomAbs_OtherCurve :{ Standard_Real k, kMin, aDist, aDt, aT1, aT2, aT; Standard_Integer aNbP, i; @@ -1396,7 +1415,6 @@ Standard_Real ResolutionCoeff(const BRepAdaptor_Curve& theBAC, break; } default: - aResCoeff = 0.; break; } // @@ -1429,6 +1447,20 @@ Standard_Real Resolution(const Handle(Geom_Curve)& theCurve, case GeomAbs_BSplineCurve: Handle(Geom_BSplineCurve)::DownCast (theCurve)->Resolution(theR3D, aRes); break; + case GeomAbs_OffsetCurve: { + const Handle(Geom_Curve)& aBasisCurve = + Handle(Geom_OffsetCurve)::DownCast(theCurve)->BasisCurve(); + const GeomAbs_CurveType aBCType = GeomAdaptor_Curve(aBasisCurve).GetType(); + if (aBCType == GeomAbs_Line) { + aRes = theR3D; + break; + } + else if (aBCType == GeomAbs_Circle) { + Standard_Real aDt = theResCoeff * theR3D; + aRes = (aDt <= 1.) ? 2*ASin(aDt) : 2*M_PI; + break; + } + } default: aRes = theResCoeff * theR3D; break; diff --git a/tests/bugs/modalg_6/bug27773 b/tests/bugs/modalg_6/bug27773 new file mode 100644 index 0000000000..846856c104 --- /dev/null +++ b/tests/bugs/modalg_6/bug27773 @@ -0,0 +1,16 @@ +puts "========" +puts "OCC27773" +puts "========" +puts "" +################################################# +# Empty result of section operation between line and offset of a circle +################################################# + +circle c 1 0 0 20 +offset c1 c 10 0 0 1 +mkedge e1 c1 +vertex v1 0 35 0 +vertex v2 0 -35 0 +edge e2 v1 v2 +bsection result e1 e2 +checknbshapes result -vertex 2