1 // Created on: 2015-09-21
2 // Copyright (c) 2015 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef _Geom2dEvaluator_OffsetCurve_HeaderFile
16 #define _Geom2dEvaluator_OffsetCurve_HeaderFile
18 #include <Geom2d_Curve.hxx>
19 #include <Geom2dAdaptor_Curve.hxx>
20 #include <Geom2dEvaluator_Curve.hxx>
22 //! Allows to calculate values and derivatives for offset curves in 2D
23 class Geom2dEvaluator_OffsetCurve : public Geom2dEvaluator_Curve
26 //! Initialize evaluator by curve
27 Standard_EXPORT Geom2dEvaluator_OffsetCurve(
28 const Handle(Geom2d_Curve)& theBase,
29 const Standard_Real theOffset);
30 //! Initialize evaluator by curve adaptor
31 Standard_EXPORT Geom2dEvaluator_OffsetCurve(
32 const Handle(Geom2dAdaptor_Curve)& theBase,
33 const Standard_Real theOffset);
35 //! Change the offset value
36 void SetOffsetValue(Standard_Real theOffset)
37 { myOffset = theOffset; }
40 Standard_EXPORT void D0(const Standard_Real theU,
41 gp_Pnt2d& theValue) const Standard_OVERRIDE;
42 //! Value and first derivatives of curve
43 Standard_EXPORT void D1(const Standard_Real theU,
44 gp_Pnt2d& theValue, gp_Vec2d& theD1) const Standard_OVERRIDE;
45 //! Value, first and second derivatives of curve
46 Standard_EXPORT void D2(const Standard_Real theU,
47 gp_Pnt2d& theValue, gp_Vec2d& theD1, gp_Vec2d& theD2) const Standard_OVERRIDE;
48 //! Value, first, second and third derivatives of curve
49 Standard_EXPORT void D3(const Standard_Real theU,
50 gp_Pnt2d& theValue, gp_Vec2d& theD1,
51 gp_Vec2d& theD2, gp_Vec2d& theD3) const Standard_OVERRIDE;
52 //! Calculates N-th derivatives of curve, where N = theDeriv. Raises if N < 1
53 Standard_EXPORT gp_Vec2d DN(const Standard_Real theU,
54 const Standard_Integer theDeriv) const Standard_OVERRIDE;
56 Standard_EXPORT Handle(Geom2dEvaluator_Curve) ShallowCopy() const Standard_OVERRIDE;
58 DEFINE_STANDARD_RTTIEXT(Geom2dEvaluator_OffsetCurve,Geom2dEvaluator_Curve)
61 //! Calculate value of base curve/adaptor
62 void BaseD0(const Standard_Real theU, gp_Pnt2d& theValue) const;
63 //! Calculate value and first derivatives of base curve/adaptor
64 void BaseD1(const Standard_Real theU,
65 gp_Pnt2d& theValue, gp_Vec2d& theD1) const;
66 //! Calculate value, first and second derivatives of base curve/adaptor
67 void BaseD2(const Standard_Real theU,
68 gp_Pnt2d& theValue, gp_Vec2d& theD1, gp_Vec2d& theD2) const;
69 //! Calculate value, first, second and third derivatives of base curve/adaptor
70 void BaseD3(const Standard_Real theU,
71 gp_Pnt2d& theValue, gp_Vec2d& theD1, gp_Vec2d& theD2, gp_Vec2d& theD3) const;
72 //! Calculate value and derivatives till 4th of base curve/adaptor
73 void BaseD4(const Standard_Real theU,
74 gp_Pnt2d& theValue, gp_Vec2d& theD1, gp_Vec2d& theD2, gp_Vec2d& theD3, gp_Vec2d& theD4) const;
75 //! Calculate N-th derivative of base curve/adaptor
76 gp_Vec2d BaseDN(const Standard_Real theU, const Standard_Integer theDeriv) const;
78 // Recalculate derivatives in the singular point
79 // Returns true if the direction of derivatives is changed
80 Standard_Boolean AdjustDerivative(const Standard_Integer theMaxDerivative,
81 const Standard_Real theU,
85 gp_Vec2d& theD4) const;
88 Handle(Geom2d_Curve) myBaseCurve;
89 Handle(Geom2dAdaptor_Curve) myBaseAdaptor;
91 Standard_Real myOffset; ///< offset value
94 DEFINE_STANDARD_HANDLE(Geom2dEvaluator_OffsetCurve, Geom2dEvaluator_Curve)
97 #endif // _Geom2dEvaluator_OffsetCurve_HeaderFile