GeomConvert_ApproxCurve::GeomConvert_ApproxCurve(const Handle(Geom_Curve)& Curve,const Standard_Real Tol3d,const GeomAbs_Shape Order,const Standard_Integer MaxSegments,const Standard_Integer MaxDegree)
{
Handle(GeomAdaptor_HCurve) HCurve = new GeomAdaptor_HCurve (Curve);
+ Approximate(HCurve, Tol3d, Order, MaxSegments, MaxDegree);
+}
+
+GeomConvert_ApproxCurve::GeomConvert_ApproxCurve(const Handle(Adaptor3d_HCurve)& Curve,const Standard_Real Tol3d,const GeomAbs_Shape Order,const Standard_Integer MaxSegments,const Standard_Integer MaxDegree)
+{
+ Approximate(Curve, Tol3d, Order, MaxSegments, MaxDegree);
+}
+void GeomConvert_ApproxCurve::Approximate(
+ const Handle(Adaptor3d_HCurve)& theCurve,
+ const Standard_Real theTol3d,
+ const GeomAbs_Shape theOrder,
+ const Standard_Integer theMaxSegments,
+ const Standard_Integer theMaxDegree)
+{
// Initialisation of input parameters of AdvApprox
Standard_Integer Num1DSS=0, Num2DSS=0, Num3DSS=1;
- Handle(TColStd_HArray1OfReal) OneDTolNul, TwoDTolNul;
- Handle(TColStd_HArray1OfReal) ThreeDTol =
- new TColStd_HArray1OfReal(1,Num3DSS);
- ThreeDTol->Init(Tol3d);
+ Handle(TColStd_HArray1OfReal) OneDTolNul, TwoDTolNul;
+ Handle(TColStd_HArray1OfReal) ThreeDTol = new TColStd_HArray1OfReal(1,Num3DSS);
+ ThreeDTol->Init(theTol3d);
- Standard_Real First = Curve->FirstParameter();
- Standard_Real Last = Curve->LastParameter();
+ Standard_Real First = theCurve->FirstParameter();
+ Standard_Real Last = theCurve->LastParameter();
- Standard_Integer NbInterv_C2 = HCurve->NbIntervals(GeomAbs_C2);
+ Standard_Integer NbInterv_C2 = theCurve->NbIntervals(GeomAbs_C2);
TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2+1);
- HCurve->Intervals(CutPnts_C2,GeomAbs_C2);
- Standard_Integer NbInterv_C3 = HCurve->NbIntervals(GeomAbs_C3);
+ theCurve->Intervals(CutPnts_C2,GeomAbs_C2);
+ Standard_Integer NbInterv_C3 = theCurve->NbIntervals(GeomAbs_C3);
TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3+1);
- HCurve->Intervals(CutPnts_C3,GeomAbs_C3);
-
+ theCurve->Intervals(CutPnts_C3,GeomAbs_C3);
+
AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);
myMaxError = 0;
- GeomConvert_ApproxCurve_Eval ev (HCurve, First, Last);
+ GeomConvert_ApproxCurve_Eval ev (theCurve, First, Last);
AdvApprox_ApproxAFunction aApprox (Num1DSS, Num2DSS, Num3DSS,
- OneDTolNul, TwoDTolNul, ThreeDTol,
- First, Last, Order,
- MaxDegree, MaxSegments,
- ev, CutTool);
+ OneDTolNul, TwoDTolNul, ThreeDTol,
+ First, Last, theOrder,
+ theMaxDegree, theMaxSegments,
+ ev, CutTool);
myIsDone = aApprox.IsDone();
myHasResult = aApprox.HasResult();