42cf5bc1 |
1 | // Created on: 1993-03-10 |
2 | // Created by: Philippe DAUTRY |
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 _Geom_Line_HeaderFile |
18 | #define _Geom_Line_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <gp_Ax1.hxx> |
24 | #include <Geom_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_Ax1; |
31 | class gp_Lin; |
32 | class gp_Pnt; |
33 | class gp_Dir; |
34 | class gp_Vec; |
35 | class gp_Trsf; |
36 | class Geom_Geometry; |
37 | |
38 | |
39 | class Geom_Line; |
40 | DEFINE_STANDARD_HANDLE(Geom_Line, Geom_Curve) |
41 | |
42 | //! Describes an infinite line. |
43 | //! A line is defined and positioned in space with an axis |
44 | //! (gp_Ax1 object) which gives it an origin and a unit vector. |
45 | //! The Geom_Line line is parameterized: |
46 | //! P (U) = O + U*Dir, where: |
47 | //! - P is the point of parameter U, |
48 | //! - O is the origin and Dir the unit vector of its positioning axis. |
49 | //! The parameter range is ] -infinite, +infinite [. |
50 | //! The orientation of the line is given by the unit vector |
51 | //! of its positioning axis. |
52 | class Geom_Line : public Geom_Curve |
53 | { |
54 | |
55 | public: |
56 | |
57 | |
58 | |
59 | //! Creates a line located in 3D space with the axis placement A1. |
60 | //! The Location of A1 is the origin of the line. |
61 | Standard_EXPORT Geom_Line(const gp_Ax1& A1); |
62 | |
63 | |
64 | //! Creates a line from a non transient line from package gp. |
65 | Standard_EXPORT Geom_Line(const gp_Lin& L); |
66 | |
67 | |
68 | //! Constructs a line passing through point P and parallel to vector V |
69 | //! (P and V are, respectively, the origin and the unit |
70 | //! vector of the positioning axis of the line). |
71 | Standard_EXPORT Geom_Line(const gp_Pnt& P, const gp_Dir& V); |
72 | |
73 | |
74 | //! Set <me> so that <me> has the same geometric properties as L. |
75 | Standard_EXPORT void SetLin (const gp_Lin& L); |
76 | |
77 | //! changes the direction of the line. |
78 | Standard_EXPORT void SetDirection (const gp_Dir& V); |
79 | |
80 | |
81 | //! changes the "Location" point (origin) of the line. |
82 | Standard_EXPORT void SetLocation (const gp_Pnt& P); |
83 | |
84 | |
85 | //! changes the "Location" and a the "Direction" of <me>. |
86 | Standard_EXPORT void SetPosition (const gp_Ax1& A1); |
87 | |
88 | |
89 | //! Returns non transient line from gp with the same geometric |
90 | //! properties as <me> |
91 | Standard_EXPORT gp_Lin Lin() const; |
92 | |
93 | //! Returns the positioning axis of this line; this is also its local coordinate system. |
94 | Standard_EXPORT const gp_Ax1& Position() const; |
95 | |
96 | //! Changes the orientation of this line. As a result, the |
97 | //! unit vector of the positioning axis of this line is reversed. |
79104795 |
98 | Standard_EXPORT void Reverse() Standard_OVERRIDE; |
42cf5bc1 |
99 | |
100 | //! Computes the parameter on the reversed line for the |
101 | //! point of parameter U on this line. |
102 | //! For a line, the returned value is -U. |
79104795 |
103 | Standard_EXPORT Standard_Real ReversedParameter (const Standard_Real U) const Standard_OVERRIDE; |
42cf5bc1 |
104 | |
105 | //! Returns the value of the first parameter of this |
106 | //! line. This is Standard_Real::RealFirst(). |
79104795 |
107 | Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE; |
42cf5bc1 |
108 | |
109 | //! Returns the value of the last parameter of this |
110 | //! line. This is Standard_Real::RealLast(). |
79104795 |
111 | Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE; |
42cf5bc1 |
112 | |
113 | //! returns False |
79104795 |
114 | Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; |
42cf5bc1 |
115 | |
116 | //! returns False |
79104795 |
117 | Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; |
42cf5bc1 |
118 | |
119 | //! Returns GeomAbs_CN, which is the global continuity of any line. |
79104795 |
120 | Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; |
42cf5bc1 |
121 | |
122 | //! returns True. |
123 | //! Raised if N < 0. |
79104795 |
124 | Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const Standard_OVERRIDE; |
42cf5bc1 |
125 | |
126 | //! Returns in P the point of parameter U. |
127 | //! P (U) = O + U * Dir where O is the "Location" point of the |
128 | //! line and Dir the direction of the line. |
79104795 |
129 | Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE; |
42cf5bc1 |
130 | |
131 | |
132 | //! Returns the point P of parameter u and the first derivative V1. |
79104795 |
133 | Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1) const Standard_OVERRIDE; |
42cf5bc1 |
134 | |
135 | |
136 | //! Returns the point P of parameter U, the first and second |
137 | //! derivatives V1 and V2. V2 is a vector with null magnitude |
138 | //! for a line. |
79104795 |
139 | Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const Standard_OVERRIDE; |
42cf5bc1 |
140 | |
141 | |
142 | //! V2 and V3 are vectors with null magnitude for a line. |
79104795 |
143 | Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const Standard_OVERRIDE; |
42cf5bc1 |
144 | |
145 | |
146 | //! The returned vector gives the value of the derivative for the |
147 | //! order of derivation N. |
148 | //! Raised if N < 1. |
79104795 |
149 | Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE; |
42cf5bc1 |
150 | |
151 | //! Applies the transformation T to this line. |
79104795 |
152 | Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE; |
42cf5bc1 |
153 | |
154 | //! Returns the parameter on the transformed curve for |
155 | //! the transform of the point of parameter U on <me>. |
156 | //! |
157 | //! me->Transformed(T)->Value(me->TransformedParameter(U,T)) |
158 | //! |
159 | //! is the same point as |
160 | //! |
161 | //! me->Value(U).Transformed(T) |
162 | //! |
163 | //! This methods returns <U> * T.ScaleFactor() |
164 | Standard_EXPORT virtual Standard_Real TransformedParameter (const Standard_Real U, const gp_Trsf& T) const Standard_OVERRIDE; |
165 | |
166 | //! Returns a coefficient to compute the parameter on |
167 | //! the transformed curve for the transform of the |
168 | //! point on <me>. |
169 | //! |
170 | //! Transformed(T)->Value(U * ParametricTransformation(T)) |
171 | //! |
172 | //! is the same point as |
173 | //! |
174 | //! Value(U).Transformed(T) |
175 | //! |
176 | //! This methods returns T.ScaleFactor() |
177 | Standard_EXPORT virtual Standard_Real ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE; |
178 | |
179 | //! Creates a new object which is a copy of this line. |
79104795 |
180 | Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE; |
42cf5bc1 |
181 | |
182 | |
183 | |
184 | |
92efcf78 |
185 | DEFINE_STANDARD_RTTIEXT(Geom_Line,Geom_Curve) |
42cf5bc1 |
186 | |
187 | protected: |
188 | |
189 | |
190 | |
191 | |
192 | private: |
193 | |
194 | |
195 | gp_Ax1 pos; |
196 | |
197 | |
198 | }; |
199 | |
200 | |
201 | |
202 | |
203 | |
204 | |
205 | |
206 | #endif // _Geom_Line_HeaderFile |