#include <ElCLib.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
+#include <Geom_Line.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Ellipse.hxx>
+#include <Geom_OffsetCurve.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <gp_Dir.hxx>
#include <gp_Lin.hxx>
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();
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;
break;
}
default:
- aResCoeff = 0.;
break;
}
//
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;