Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 09:16:23

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 #include <Standard_Integer.hxx>
0027 class gp_Lin;
0028 class gp_Pnt;
0029 class gp_Dir;
0030 class gp_Vec;
0031 class gp_Trsf;
0032 class Geom_Geometry;
0033 
0034 class Geom_Line;
0035 DEFINE_STANDARD_HANDLE(Geom_Line, Geom_Curve)
0036 
0037 //! Describes an infinite line.
0038 //! A line is defined and positioned in space with an axis
0039 //! (gp_Ax1 object) which gives it an origin and a unit vector.
0040 //! The Geom_Line line is parameterized:
0041 //! P (U) = O + U*Dir, where:
0042 //! - P is the point of parameter U,
0043 //! - O is the origin and Dir the unit vector of its positioning axis.
0044 //! The parameter range is ] -infinite, +infinite [.
0045 //! The orientation of the line is given by the unit vector
0046 //! of its positioning axis.
0047 class Geom_Line : public Geom_Curve
0048 {
0049 
0050 public:
0051   //! Creates a line located in 3D space with the axis placement A1.
0052   //! The Location of A1 is the origin of the line.
0053   Standard_EXPORT Geom_Line(const gp_Ax1& A1);
0054 
0055   //! Creates a line from a non transient line from package gp.
0056   Standard_EXPORT Geom_Line(const gp_Lin& L);
0057 
0058   //! Constructs a line passing through point P and parallel to vector V
0059   //! (P and V are, respectively, the origin and the unit
0060   //! vector of the positioning axis of the line).
0061   Standard_EXPORT Geom_Line(const gp_Pnt& P, const gp_Dir& V);
0062 
0063   //! Set <me> so that <me> has the same geometric properties as L.
0064   Standard_EXPORT void SetLin(const gp_Lin& L);
0065 
0066   //! changes the direction of the line.
0067   Standard_EXPORT void SetDirection(const gp_Dir& V);
0068 
0069   //! changes the "Location" point (origin) of the line.
0070   Standard_EXPORT void SetLocation(const gp_Pnt& P);
0071 
0072   //! changes the "Location" and a the "Direction" of <me>.
0073   Standard_EXPORT void SetPosition(const gp_Ax1& A1);
0074 
0075   //! Returns non transient line from gp with the same geometric
0076   //! properties as <me>
0077   Standard_EXPORT gp_Lin Lin() const;
0078 
0079   //! Returns the positioning axis of this line; this is also its local coordinate system.
0080   Standard_EXPORT const gp_Ax1& Position() const;
0081 
0082   //! Changes the orientation of this line. As a result, the
0083   //! unit vector of the positioning axis of this line is reversed.
0084   Standard_EXPORT void Reverse() Standard_OVERRIDE;
0085 
0086   //! Computes the parameter on the reversed line for the
0087   //! point of parameter U on this line.
0088   //! For a line, the returned value is -U.
0089   Standard_EXPORT Standard_Real ReversedParameter(const Standard_Real U) const Standard_OVERRIDE;
0090 
0091   //! Returns the value of the first parameter of this
0092   //! line. This is Standard_Real::RealFirst().
0093   Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
0094 
0095   //! Returns the value of the last parameter of this
0096   //! line. This is  Standard_Real::RealLast().
0097   Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
0098 
0099   //! returns False
0100   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
0101 
0102   //! returns False
0103   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
0104 
0105   //! Returns GeomAbs_CN, which is the global continuity of any line.
0106   Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
0107 
0108   //! returns True.
0109   //! Raised if N < 0.
0110   Standard_EXPORT Standard_Boolean IsCN(const Standard_Integer N) const Standard_OVERRIDE;
0111 
0112   //! Returns in P the point of parameter U.
0113   //! P (U) = O + U * Dir where O is the "Location" point of the
0114   //! line and Dir the direction of the line.
0115   Standard_EXPORT void D0(const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE;
0116 
0117   //! Returns the point P of parameter u and the first derivative V1.
0118   Standard_EXPORT void D1(const Standard_Real U, gp_Pnt& P, gp_Vec& V1) const Standard_OVERRIDE;
0119 
0120   //! Returns the point P of parameter U, the first and second
0121   //! derivatives V1 and V2. V2 is a vector with null magnitude
0122   //! for a line.
0123   Standard_EXPORT void D2(const Standard_Real U,
0124                           gp_Pnt&             P,
0125                           gp_Vec&             V1,
0126                           gp_Vec&             V2) const Standard_OVERRIDE;
0127 
0128   //! V2 and V3 are vectors with null magnitude for a line.
0129   Standard_EXPORT void D3(const Standard_Real U,
0130                           gp_Pnt&             P,
0131                           gp_Vec&             V1,
0132                           gp_Vec&             V2,
0133                           gp_Vec&             V3) const Standard_OVERRIDE;
0134 
0135   //! The returned vector gives the value of the derivative for the
0136   //! order of derivation N.
0137   //! Raised if N < 1.
0138   Standard_EXPORT gp_Vec DN(const Standard_Real    U,
0139                             const Standard_Integer N) const Standard_OVERRIDE;
0140 
0141   //! Applies the transformation T to this line.
0142   Standard_EXPORT void Transform(const gp_Trsf& T) Standard_OVERRIDE;
0143 
0144   //! Returns the  parameter on the  transformed  curve for
0145   //! the transform of the point of parameter U on <me>.
0146   //!
0147   //! me->Transformed(T)->Value(me->TransformedParameter(U,T))
0148   //!
0149   //! is the same point as
0150   //!
0151   //! me->Value(U).Transformed(T)
0152   //!
0153   //! This methods returns <U> * T.ScaleFactor()
0154   Standard_EXPORT virtual Standard_Real TransformedParameter(const Standard_Real U,
0155                                                              const gp_Trsf&      T) const
0156     Standard_OVERRIDE;
0157 
0158   //! Returns a  coefficient to compute the parameter on
0159   //! the transformed  curve  for  the transform  of the
0160   //! point on <me>.
0161   //!
0162   //! Transformed(T)->Value(U * ParametricTransformation(T))
0163   //!
0164   //! is the same point as
0165   //!
0166   //! Value(U).Transformed(T)
0167   //!
0168   //! This methods returns T.ScaleFactor()
0169   Standard_EXPORT virtual Standard_Real ParametricTransformation(const gp_Trsf& T) const
0170     Standard_OVERRIDE;
0171 
0172   //! Creates a new object which is a copy of this line.
0173   Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
0174 
0175   //! Dumps the content of me into the stream
0176   Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream,
0177                                         Standard_Integer  theDepth = -1) const Standard_OVERRIDE;
0178 
0179   DEFINE_STANDARD_RTTIEXT(Geom_Line, Geom_Curve)
0180 
0181 protected:
0182 private:
0183   gp_Ax1 pos;
0184 };
0185 
0186 #endif // _Geom_Line_HeaderFile