Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-24 09:13:47

0001 // Created on: 1993-03-10
0002 // Created by: Philippe DAUTRY
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Geom_Line_HeaderFile
0018 #define _Geom_Line_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <gp_Ax1.hxx>
0024 #include <Geom_Curve.hxx>
0025 #include <GeomAbs_Shape.hxx>
0026 class gp_Lin;
0027 class gp_Dir;
0028 class gp_Trsf;
0029 class Geom_Geometry;
0030 
0031 //! Describes an infinite line.
0032 //! A line is defined and positioned in space with an axis
0033 //! (gp_Ax1 object) which gives it an origin and a unit vector.
0034 //! The Geom_Line line is parameterized:
0035 //! P (U) = O + U*Dir, where:
0036 //! - P is the point of parameter U,
0037 //! - O is the origin and Dir the unit vector of its positioning axis.
0038 //! The parameter range is ] -infinite, +infinite [.
0039 //! The orientation of the line is given by the unit vector
0040 //! of its positioning axis.
0041 class Geom_Line : public Geom_Curve
0042 {
0043 
0044 public:
0045   //! Creates a line located in 3D space with the axis placement A1.
0046   //! The Location of A1 is the origin of the line.
0047   Standard_EXPORT Geom_Line(const gp_Ax1& A1);
0048 
0049   //! Creates a line from a non transient line from package gp.
0050   Standard_EXPORT Geom_Line(const gp_Lin& L);
0051 
0052   //! Constructs a line passing through point P and parallel to vector V
0053   //! (P and V are, respectively, the origin and the unit
0054   //! vector of the positioning axis of the line).
0055   Standard_EXPORT Geom_Line(const gp_Pnt& P, const gp_Dir& V);
0056 
0057   //! Set <me> so that <me> has the same geometric properties as L.
0058   Standard_EXPORT void SetLin(const gp_Lin& L);
0059 
0060   //! changes the direction of the line.
0061   Standard_EXPORT void SetDirection(const gp_Dir& V);
0062 
0063   //! changes the "Location" point (origin) of the line.
0064   Standard_EXPORT void SetLocation(const gp_Pnt& P);
0065 
0066   //! changes the "Location" and a the "Direction" of <me>.
0067   Standard_EXPORT void SetPosition(const gp_Ax1& A1);
0068 
0069   //! Returns non transient line from gp with the same geometric
0070   //! properties as <me>
0071   Standard_EXPORT gp_Lin Lin() const;
0072 
0073   //! Returns the positioning axis of this line; this is also its local coordinate system.
0074   Standard_EXPORT const gp_Ax1& Position() const;
0075 
0076   //! Changes the orientation of this line. As a result, the
0077   //! unit vector of the positioning axis of this line is reversed.
0078   Standard_EXPORT void Reverse() final;
0079 
0080   //! Computes the parameter on the reversed line for the
0081   //! point of parameter U on this line.
0082   //! For a line, the returned value is -U.
0083   Standard_EXPORT double ReversedParameter(const double U) const final;
0084 
0085   //! Returns the value of the first parameter of this
0086   //! line. This is double::RealFirst().
0087   Standard_EXPORT double FirstParameter() const final;
0088 
0089   //! Returns the value of the last parameter of this
0090   //! line. This is double::RealLast().
0091   Standard_EXPORT double LastParameter() const final;
0092 
0093   //! returns False
0094   Standard_EXPORT bool IsClosed() const final;
0095 
0096   //! returns False
0097   Standard_EXPORT bool IsPeriodic() const final;
0098 
0099   //! Returns GeomAbs_CN, which is the global continuity of any line.
0100   Standard_EXPORT GeomAbs_Shape Continuity() const final;
0101 
0102   //! returns True.
0103   //! Raised if N < 0.
0104   Standard_EXPORT bool IsCN(const int N) const final;
0105 
0106   //! Returns the point of parameter U.
0107   //! P (U) = O + U * Dir where O is the "Location" point of the
0108   //! line and Dir the direction of the line.
0109   Standard_EXPORT gp_Pnt EvalD0(const double U) const final;
0110 
0111   //! Returns the point of parameter U and the first derivative.
0112   Standard_EXPORT Geom_Curve::ResD1 EvalD1(const double U) const final;
0113 
0114   //! Returns the point of parameter U, the first and second
0115   //! derivatives. The second derivative is a vector with null magnitude
0116   //! for a line.
0117   Standard_EXPORT Geom_Curve::ResD2 EvalD2(const double U) const final;
0118 
0119   //! Returns the point of parameter U, the first, second and third
0120   //! derivatives. The second and third derivatives are vectors with null magnitude for a line.
0121   Standard_EXPORT Geom_Curve::ResD3 EvalD3(const double U) const final;
0122 
0123   //! Returns the vector corresponding to the derivative for the
0124   //! order of derivation N.
0125   //! Raised if N < 1.
0126   Standard_EXPORT gp_Vec EvalDN(const double U, const int N) const final;
0127 
0128   //! Applies the transformation T to this line.
0129   Standard_EXPORT void Transform(const gp_Trsf& T) final;
0130 
0131   //! Returns the parameter on the transformed curve for
0132   //! the transform of the point of parameter U on <me>.
0133   //!
0134   //! me->Transformed(T)->Value(me->TransformedParameter(U,T))
0135   //!
0136   //! is the same point as
0137   //!
0138   //! me->Value(U).Transformed(T)
0139   //!
0140   //! This methods returns <U> * T.ScaleFactor()
0141   Standard_EXPORT double TransformedParameter(const double U, const gp_Trsf& T) const final;
0142 
0143   //! Returns a coefficient to compute the parameter on
0144   //! the transformed curve for the transform of the
0145   //! point on <me>.
0146   //!
0147   //! Transformed(T)->Value(U * ParametricTransformation(T))
0148   //!
0149   //! is the same point as
0150   //!
0151   //! Value(U).Transformed(T)
0152   //!
0153   //! This methods returns T.ScaleFactor()
0154   Standard_EXPORT double ParametricTransformation(const gp_Trsf& T) const final;
0155 
0156   //! Creates a new object which is a copy of this line.
0157   Standard_EXPORT occ::handle<Geom_Geometry> Copy() const final;
0158 
0159   //! Dumps the content of me into the stream
0160   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const final;
0161 
0162   DEFINE_STANDARD_RTTIEXT(Geom_Line, Geom_Curve)
0163 
0164 private:
0165   gp_Ax1 pos;
0166 };
0167 
0168 #endif // _Geom_Line_HeaderFile