0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / Geom2dEvaluator / Geom2dEvaluator_OffsetCurve.hxx
CommitLineData
d660a72a 1// Created on: 2015-09-21
2// Copyright (c) 2015 OPEN CASCADE SAS
3//
4// This file is part of Open CASCADE Technology software library.
5//
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.
11//
12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
14
15#ifndef _Geom2dEvaluator_OffsetCurve_HeaderFile
16#define _Geom2dEvaluator_OffsetCurve_HeaderFile
17
18#include <Geom2d_Curve.hxx>
19#include <Geom2dEvaluator_Curve.hxx>
20
21class Geom2dAdaptor_HCurve;
22
23//! Allows to calculate values and derivatives for offset curves in 2D
24class Geom2dEvaluator_OffsetCurve : public Geom2dEvaluator_Curve
25{
26public:
27 //! Initialize evaluator by curve
28 Standard_EXPORT Geom2dEvaluator_OffsetCurve(
29 const Handle(Geom2d_Curve)& theBase,
30 const Standard_Real theOffset);
31 //! Initialize evaluator by curve adaptor
32 Standard_EXPORT Geom2dEvaluator_OffsetCurve(
33 const Handle(Geom2dAdaptor_HCurve)& theBase,
34 const Standard_Real theOffset);
35
36 //! Change the offset value
37 void SetOffsetValue(Standard_Real theOffset)
38 { myOffset = theOffset; }
39
40 //! Value of curve
41 Standard_EXPORT void D0(const Standard_Real theU,
42 gp_Pnt2d& theValue) const Standard_OVERRIDE;
43 //! Value and first derivatives of curve
44 Standard_EXPORT void D1(const Standard_Real theU,
45 gp_Pnt2d& theValue, gp_Vec2d& theD1) const Standard_OVERRIDE;
46 //! Value, first and second derivatives of curve
47 Standard_EXPORT void D2(const Standard_Real theU,
48 gp_Pnt2d& theValue, gp_Vec2d& theD1, gp_Vec2d& theD2) const Standard_OVERRIDE;
49 //! Value, first, second and third derivatives of curve
50 Standard_EXPORT void D3(const Standard_Real theU,
51 gp_Pnt2d& theValue, gp_Vec2d& theD1,
52 gp_Vec2d& theD2, gp_Vec2d& theD3) const Standard_OVERRIDE;
53 //! Calculates N-th derivatives of curve, where N = theDeriv. Raises if N < 1
54 Standard_EXPORT gp_Vec2d DN(const Standard_Real theU,
55 const Standard_Integer theDeriv) const Standard_OVERRIDE;
56
92efcf78 57 DEFINE_STANDARD_RTTIEXT(Geom2dEvaluator_OffsetCurve,Geom2dEvaluator_Curve)
d660a72a 58
59private:
60 //! Recalculate D1 values of base curve into D0 value of offset curve
61 void CalculateD0( gp_Pnt2d& theValue,
62 const gp_Vec2d& theD1) const;
63 //! Recalculate D2 values of base curve into D1 values of offset curve
64 void CalculateD1( gp_Pnt2d& theValue,
65 gp_Vec2d& theD1,
66 const gp_Vec2d& theD2) const;
67 //! Recalculate D3 values of base curve into D2 values of offset curve
68 void CalculateD2( gp_Pnt2d& theValue,
69 gp_Vec2d& theD1,
70 gp_Vec2d& theD2,
71 const gp_Vec2d& theD3,
72 const Standard_Boolean theIsDirChange) const;
73 //! Recalculate D3 values of base curve into D3 values of offset curve
74 void CalculateD3( gp_Pnt2d& theValue,
75 gp_Vec2d& theD1,
76 gp_Vec2d& theD2,
77 gp_Vec2d& theD3,
78 const gp_Vec2d& theD4,
79 const Standard_Boolean theIsDirChange) const;
80
81 //! Calculate value of base curve/adaptor
82 void BaseD0(const Standard_Real theU, gp_Pnt2d& theValue) const;
83 //! Calculate value and first derivatives of base curve/adaptor
84 void BaseD1(const Standard_Real theU,
85 gp_Pnt2d& theValue, gp_Vec2d& theD1) const;
86 //! Calculate value, first and second derivatives of base curve/adaptor
87 void BaseD2(const Standard_Real theU,
88 gp_Pnt2d& theValue, gp_Vec2d& theD1, gp_Vec2d& theD2) const;
89 //! Calculate value, first, second and third derivatives of base curve/adaptor
90 void BaseD3(const Standard_Real theU,
91 gp_Pnt2d& theValue, gp_Vec2d& theD1, gp_Vec2d& theD2, gp_Vec2d& theD3) const;
92 //! Calculate value and derivatives till 4th of base curve/adaptor
93 void BaseD4(const Standard_Real theU,
94 gp_Pnt2d& theValue, gp_Vec2d& theD1, gp_Vec2d& theD2, gp_Vec2d& theD3, gp_Vec2d& theD4) const;
95 //! Calculate N-th derivative of base curve/adaptor
96 gp_Vec2d BaseDN(const Standard_Real theU, const Standard_Integer theDeriv) const;
97
98 // Recalculate derivatives in the singular point
99 // Returns true if the direction of derivatives is changed
100 Standard_Boolean AdjustDerivative(const Standard_Integer theMaxDerivative,
101 const Standard_Real theU,
102 gp_Vec2d& theD1,
103 gp_Vec2d& theD2,
104 gp_Vec2d& theD3,
105 gp_Vec2d& theD4) const;
106
107private:
108 Handle(Geom2d_Curve) myBaseCurve;
109 Handle(Geom2dAdaptor_HCurve) myBaseAdaptor;
110
111 Standard_Real myOffset; ///< offset value
112};
113
114DEFINE_STANDARD_HANDLE(Geom2dEvaluator_OffsetCurve, Geom2dEvaluator_Curve)
115
116
117#endif // _Geom2dEvaluator_OffsetCurve_HeaderFile