42cf5bc1 |
1 | // Created on: 1993-03-24 |
2 | // Created by: JCV |
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 | |
17 | #ifndef _Geom2d_Line_HeaderFile |
18 | #define _Geom2d_Line_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <gp_Ax2d.hxx> |
24 | #include <Geom2d_Curve.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <Standard_Boolean.hxx> |
27 | #include <GeomAbs_Shape.hxx> |
28 | #include <Standard_Integer.hxx> |
29 | class Standard_RangeError; |
30 | class gp_Ax2d; |
31 | class gp_Lin2d; |
32 | class gp_Pnt2d; |
33 | class gp_Dir2d; |
34 | class gp_Vec2d; |
35 | class gp_Trsf2d; |
36 | class Geom2d_Geometry; |
37 | |
38 | |
39 | class Geom2d_Line; |
40 | DEFINE_STANDARD_HANDLE(Geom2d_Line, Geom2d_Curve) |
41 | |
42 | //! Describes an infinite line in the plane (2D space). |
43 | //! A line is defined and positioned in the plane with an |
44 | //! axis (gp_Ax2d object) which gives it an origin and a unit vector. |
45 | //! The Geom2d_Line line is parameterized as follows: |
46 | //! P (U) = O + U*Dir |
47 | //! where: |
48 | //! - P is the point of parameter U, |
49 | //! - O is the origin and Dir the unit vector of its positioning axis. |
50 | //! The parameter range is ] -infinite, +infinite [. |
51 | //! The orientation of the line is given by the unit vector |
52 | //! of its positioning axis. |
53 | //! See Also |
54 | //! GCE2d_MakeLine which provides functions for more |
55 | //! complex line constructions |
56 | //! gp_Ax2d |
57 | //! gp_Lin2d for an equivalent, non-parameterized data structure. |
58 | class Geom2d_Line : public Geom2d_Curve |
59 | { |
60 | |
61 | public: |
62 | |
63 | |
64 | |
65 | //! Creates a line located in 2D space with the axis placement A. |
66 | //! The Location of A is the origin of the line. |
67 | Standard_EXPORT Geom2d_Line(const gp_Ax2d& A); |
68 | |
69 | |
70 | //! Creates a line by conversion of the gp_Lin2d line L. |
71 | Standard_EXPORT Geom2d_Line(const gp_Lin2d& L); |
72 | |
73 | //! Constructs a line passing through point P and parallel to |
74 | //! vector V (P and V are, respectively, the origin |
75 | //! and the unit vector of the positioning axis of the line). |
76 | Standard_EXPORT Geom2d_Line(const gp_Pnt2d& P, const gp_Dir2d& V); |
77 | |
78 | |
79 | //! Set <me> so that <me> has the same geometric properties as L. |
80 | Standard_EXPORT void SetLin2d (const gp_Lin2d& L); |
81 | |
82 | //! changes the direction of the line. |
83 | Standard_EXPORT void SetDirection (const gp_Dir2d& V); |
84 | |
85 | //! changes the direction of the line. |
86 | Standard_EXPORT const gp_Dir2d& Direction() const; |
87 | |
88 | |
89 | //! Changes the "Location" point (origin) of the line. |
90 | Standard_EXPORT void SetLocation (const gp_Pnt2d& P); |
91 | |
92 | |
93 | //! Changes the "Location" point (origin) of the line. |
94 | Standard_EXPORT const gp_Pnt2d& Location() const; |
95 | |
96 | |
97 | //! Changes the "Location" and a the "Direction" of <me>. |
98 | Standard_EXPORT void SetPosition (const gp_Ax2d& A); |
99 | |
100 | Standard_EXPORT const gp_Ax2d& Position() const; |
101 | |
102 | |
103 | //! Returns non persistent line from gp with the same geometric |
104 | //! properties as <me> |
105 | Standard_EXPORT gp_Lin2d Lin2d() const; |
106 | |
107 | //! Changes the orientation of this line. As a result, the |
108 | //! unit vector of the positioning axis of this line is reversed. |
79104795 |
109 | Standard_EXPORT void Reverse() Standard_OVERRIDE; |
42cf5bc1 |
110 | |
111 | //! Computes the parameter on the reversed line for the |
112 | //! point of parameter U on this line. |
113 | //! For a line, the returned value is -U. |
79104795 |
114 | Standard_EXPORT Standard_Real ReversedParameter (const Standard_Real U) const Standard_OVERRIDE; |
42cf5bc1 |
115 | |
116 | //! Returns RealFirst from Standard. |
79104795 |
117 | Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE; |
42cf5bc1 |
118 | |
119 | //! Returns RealLast from Standard |
79104795 |
120 | Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE; |
42cf5bc1 |
121 | |
122 | //! Returns False |
79104795 |
123 | Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; |
42cf5bc1 |
124 | |
125 | //! Returns False |
79104795 |
126 | Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; |
42cf5bc1 |
127 | |
128 | //! Returns GeomAbs_CN, which is the global continuity of any line. |
79104795 |
129 | Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; |
42cf5bc1 |
130 | |
131 | //! Computes the distance between <me> and the point P. |
132 | Standard_EXPORT Standard_Real Distance (const gp_Pnt2d& P) const; |
133 | |
134 | //! Returns True. |
79104795 |
135 | Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const Standard_OVERRIDE; |
42cf5bc1 |
136 | |
137 | //! Returns in P the point of parameter U. |
138 | //! P (U) = O + U * Dir where O is the "Location" point of the |
139 | //! line and Dir the direction of the line. |
79104795 |
140 | Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE; |
42cf5bc1 |
141 | |
142 | |
143 | //! Returns the point P of parameter u and the first derivative V1. |
79104795 |
144 | Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1) const Standard_OVERRIDE; |
42cf5bc1 |
145 | |
146 | |
147 | //! Returns the point P of parameter U, the first and second |
148 | //! derivatives V1 and V2. V2 is a vector with null magnitude |
149 | //! for a line. |
79104795 |
150 | Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const Standard_OVERRIDE; |
42cf5bc1 |
151 | |
152 | |
153 | //! V2 and V3 are vectors with null magnitude for a line. |
79104795 |
154 | Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const Standard_OVERRIDE; |
42cf5bc1 |
155 | |
156 | //! For the point of parameter U of this line, computes |
157 | //! the vector corresponding to the Nth derivative. |
158 | //! Note: if N is greater than or equal to 2, the result is a |
159 | //! vector with null magnitude. |
160 | //! Exceptions Standard_RangeError if N is less than 1. |
79104795 |
161 | Standard_EXPORT gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE; |
42cf5bc1 |
162 | |
163 | //! Applies the transformation T to this line. |
79104795 |
164 | Standard_EXPORT void Transform (const gp_Trsf2d& T) Standard_OVERRIDE; |
42cf5bc1 |
165 | |
166 | //! Computes the parameter on the line transformed by |
167 | //! T for the point of parameter U on this line. |
168 | //! For a line, the returned value is equal to U multiplied |
169 | //! by the scale factor of transformation T. |
170 | Standard_EXPORT virtual Standard_Real TransformedParameter (const Standard_Real U, const gp_Trsf2d& T) const Standard_OVERRIDE; |
171 | |
172 | //! Returns the coefficient required to compute the |
173 | //! parametric transformation of this line when |
174 | //! transformation T is applied. This coefficient is the |
175 | //! ratio between the parameter of a point on this line |
176 | //! and the parameter of the transformed point on the |
177 | //! new line transformed by T. |
178 | //! For a line, the returned value is the scale factor of the transformation T. |
179 | Standard_EXPORT virtual Standard_Real ParametricTransformation (const gp_Trsf2d& T) const Standard_OVERRIDE; |
180 | |
181 | //! Creates a new object, which is a copy of this line. |
79104795 |
182 | Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE; |
42cf5bc1 |
183 | |
184 | |
185 | |
186 | |
92efcf78 |
187 | DEFINE_STANDARD_RTTIEXT(Geom2d_Line,Geom2d_Curve) |
42cf5bc1 |
188 | |
189 | protected: |
190 | |
191 | |
192 | |
193 | |
194 | private: |
195 | |
196 | |
197 | gp_Ax2d pos; |
198 | |
199 | |
200 | }; |
201 | |
202 | |
203 | |
204 | |
205 | |
206 | |
207 | |
208 | #endif // _Geom2d_Line_HeaderFile |