0031303: Different calculation of offset direction in Adaptor2d_OffsetCurve and Geom2...
[occt.git] / src / Adaptor2d / Adaptor2d_OffsetCurve.hxx
CommitLineData
42cf5bc1 1// Created on: 1993-04-15
2// Created by: Bruno DUMORTIER
3// Copyright (c) 1993-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
5201d3e6 17#ifndef _Adaptor2d_OffsetCurve_HeaderFile
18#define _Adaptor2d_OffsetCurve_HeaderFile
42cf5bc1 19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Real.hxx>
25#include <Adaptor2d_Curve2d.hxx>
26#include <GeomAbs_Shape.hxx>
27#include <Standard_Integer.hxx>
28#include <TColStd_Array1OfReal.hxx>
29#include <Standard_Boolean.hxx>
30#include <GeomAbs_CurveType.hxx>
31class Adaptor2d_HCurve2d;
32class Standard_NoSuchObject;
33class Standard_DomainError;
34class Standard_OutOfRange;
35class Standard_TypeMismatch;
36class gp_Pnt2d;
37class gp_Vec2d;
38class gp_Lin2d;
39class gp_Circ2d;
40class gp_Elips2d;
41class gp_Hypr2d;
42class gp_Parab2d;
43class Geom2d_BezierCurve;
44class Geom2d_BSplineCurve;
45
46
47//! Defines an Offset curve (algorithmic 2d curve).
5201d3e6 48class Adaptor2d_OffsetCurve : public Adaptor2d_Curve2d
42cf5bc1 49{
50public:
51
52 DEFINE_STANDARD_ALLOC
53
54
55 //! The Offset is set to 0.
5201d3e6 56 Standard_EXPORT Adaptor2d_OffsetCurve();
42cf5bc1 57
58 //! The curve is loaded. The Offset is set to 0.
5201d3e6 59 Standard_EXPORT Adaptor2d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C);
42cf5bc1 60
61 //! Creates an OffsetCurve curve.
62 //! The Offset is set to Offset.
5201d3e6 63 Standard_EXPORT Adaptor2d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real Offset);
42cf5bc1 64
65 //! Create an Offset curve.
66 //! WFirst,WLast define the bounds of the Offset curve.
5201d3e6 67 Standard_EXPORT Adaptor2d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real Offset, const Standard_Real WFirst, const Standard_Real WLast);
42cf5bc1 68
69 //! Changes the curve. The Offset is reset to 0.
70 Standard_EXPORT void Load (const Handle(Adaptor2d_HCurve2d)& S);
71
72 //! Changes the Offset on the current Curve.
73 Standard_EXPORT void Load (const Standard_Real Offset);
74
75 //! Changes the Offset Curve on the current Curve.
76 Standard_EXPORT void Load (const Standard_Real Offset, const Standard_Real WFirst, const Standard_Real WLast);
77
78 const Handle(Adaptor2d_HCurve2d)& Curve() const;
79
80 Standard_Real Offset() const;
81
82 Standard_Real FirstParameter() const Standard_OVERRIDE;
83
84 Standard_Real LastParameter() const Standard_OVERRIDE;
85
86 Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
87
88 //! If necessary, breaks the curve in intervals of
89 //! continuity <S>. And returns the number of
90 //! intervals.
91 Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
92
93 //! Stores in <T> the parameters bounding the intervals
94 //! of continuity <S>.
95 //!
96 //! The array must provide enough room to accomodate
97 //! for the parameters. i.e. T.Length() > NbIntervals()
98 Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
99
100 //! Returns a curve equivalent of <me> between
101 //! parameters <First> and <Last>. <Tol> is used to
102 //! test for 3d points confusion.
103 //! If <First> >= <Last>
104 Standard_EXPORT Handle(Adaptor2d_HCurve2d) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
105
106 Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
107
108 Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
109
110 Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
111
112 //! Computes the point of parameter U on the curve.
113 Standard_EXPORT gp_Pnt2d Value (const Standard_Real U) const Standard_OVERRIDE;
114
115 //! Computes the point of parameter U on the curve.
116 Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE;
117
118 //! Computes the point of parameter U on the curve with its
119 //! first derivative.
120 //! Raised if the continuity of the current interval
121 //! is not C1.
122 Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V) const Standard_OVERRIDE;
123
124
125 //! Returns the point P of parameter U, the first and second
126 //! derivatives V1 and V2.
127 //! Raised if the continuity of the current interval
128 //! is not C2.
129 Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const Standard_OVERRIDE;
130
131
132 //! Returns the point P of parameter U, the first, the second
133 //! and the third derivative.
134 //! Raised if the continuity of the current interval
135 //! is not C3.
136 Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const Standard_OVERRIDE;
137
138
139 //! The returned vector gives the value of the derivative for the
140 //! order of derivation N.
141 //! Raised if the continuity of the current interval
142 //! is not CN.
143 //! Raised if N < 1.
144 Standard_EXPORT gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
145
146 //! Returns the parametric resolution corresponding
147 //! to the real space resolution <R3d>.
148 Standard_EXPORT Standard_Real Resolution (const Standard_Real R3d) const Standard_OVERRIDE;
149
150 //! Returns the type of the curve in the current
151 //! interval : Line, Circle, Ellipse, Hyperbola,
152 //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
153 Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE;
154
155 Standard_EXPORT gp_Lin2d Line() const Standard_OVERRIDE;
156
157 Standard_EXPORT gp_Circ2d Circle() const Standard_OVERRIDE;
158
159 Standard_EXPORT gp_Elips2d Ellipse() const Standard_OVERRIDE;
160
161 Standard_EXPORT gp_Hypr2d Hyperbola() const Standard_OVERRIDE;
162
163 Standard_EXPORT gp_Parab2d Parabola() const Standard_OVERRIDE;
164
165 Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE;
166
167 Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE;
168
169 Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE;
170
171 Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE;
172
173 Standard_EXPORT Handle(Geom2d_BezierCurve) Bezier() const Standard_OVERRIDE;
174
175 Standard_EXPORT Handle(Geom2d_BSplineCurve) BSpline() const Standard_OVERRIDE;
176
833034f3 177 Standard_EXPORT Standard_Integer NbSamples() const Standard_OVERRIDE;
42cf5bc1 178
179
180
181protected:
182
183
184
185
186
187private:
188
189
190
191 Handle(Adaptor2d_HCurve2d) myCurve;
192 Standard_Real myOffset;
193 Standard_Real myFirst;
194 Standard_Real myLast;
195
42cf5bc1 196};
197
198
5201d3e6 199#include <Adaptor2d_OffsetCurve.lxx>
42cf5bc1 200
201
202
203
204
5201d3e6 205#endif // _Adaptor2d_OffsetCurve_HeaderFile