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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Geom_Line_HeaderFile
18 #define _Geom_Line_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.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;
40 DEFINE_STANDARD_HANDLE(Geom_Line, Geom_Curve)
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
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);
64 //! Creates a line from a non transient line from package gp.
65 Standard_EXPORT Geom_Line(const gp_Lin& L);
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);
74 //! Set <me> so that <me> has the same geometric properties as L.
75 Standard_EXPORT void SetLin (const gp_Lin& L);
77 //! changes the direction of the line.
78 Standard_EXPORT void SetDirection (const gp_Dir& V);
81 //! changes the "Location" point (origin) of the line.
82 Standard_EXPORT void SetLocation (const gp_Pnt& P);
85 //! changes the "Location" and a the "Direction" of <me>.
86 Standard_EXPORT void SetPosition (const gp_Ax1& A1);
89 //! Returns non transient line from gp with the same geometric
90 //! properties as <me>
91 Standard_EXPORT gp_Lin Lin() const;
93 //! Returns the positioning axis of this line; this is also its local coordinate system.
94 Standard_EXPORT const gp_Ax1& Position() const;
96 //! Changes the orientation of this line. As a result, the
97 //! unit vector of the positioning axis of this line is reversed.
98 Standard_EXPORT void Reverse() Standard_OVERRIDE;
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.
103 Standard_EXPORT Standard_Real ReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
105 //! Returns the value of the first parameter of this
106 //! line. This is Standard_Real::RealFirst().
107 Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
109 //! Returns the value of the last parameter of this
110 //! line. This is Standard_Real::RealLast().
111 Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
114 Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
117 Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
119 //! Returns GeomAbs_CN, which is the global continuity of any line.
120 Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
124 Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const Standard_OVERRIDE;
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.
129 Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE;
132 //! Returns the point P of parameter u and the first derivative V1.
133 Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1) const Standard_OVERRIDE;
136 //! Returns the point P of parameter U, the first and second
137 //! derivatives V1 and V2. V2 is a vector with null magnitude
139 Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const Standard_OVERRIDE;
142 //! V2 and V3 are vectors with null magnitude for a line.
143 Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const Standard_OVERRIDE;
146 //! The returned vector gives the value of the derivative for the
147 //! order of derivation N.
149 Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
151 //! Applies the transformation T to this line.
152 Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
154 //! Returns the parameter on the transformed curve for
155 //! the transform of the point of parameter U on <me>.
157 //! me->Transformed(T)->Value(me->TransformedParameter(U,T))
159 //! is the same point as
161 //! me->Value(U).Transformed(T)
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;
166 //! Returns a coefficient to compute the parameter on
167 //! the transformed curve for the transform of the
170 //! Transformed(T)->Value(U * ParametricTransformation(T))
172 //! is the same point as
174 //! Value(U).Transformed(T)
176 //! This methods returns T.ScaleFactor()
177 Standard_EXPORT virtual Standard_Real ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE;
179 //! Creates a new object which is a copy of this line.
180 Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
182 //! Dumps the content of me into the stream
183 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
188 DEFINE_STANDARD_RTTIEXT(Geom_Line,Geom_Curve)
209 #endif // _Geom_Line_HeaderFile