Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:33

0001 // Created on: 1993-03-24
0002 // Created by: JCV
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 _Geom2d_Line_HeaderFile
0018 #define _Geom2d_Line_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <gp_Ax2d.hxx>
0024 #include <Geom2d_Curve.hxx>
0025 #include <GeomAbs_Shape.hxx>
0026 #include <Standard_Integer.hxx>
0027 class gp_Lin2d;
0028 class gp_Pnt2d;
0029 class gp_Dir2d;
0030 class gp_Vec2d;
0031 class gp_Trsf2d;
0032 class Geom2d_Geometry;
0033 
0034 
0035 class Geom2d_Line;
0036 DEFINE_STANDARD_HANDLE(Geom2d_Line, Geom2d_Curve)
0037 
0038 //! Describes an infinite line in the plane (2D space).
0039 //! A line is defined and positioned in the plane with an
0040 //! axis (gp_Ax2d object) which gives it an origin and a unit vector.
0041 //! The Geom2d_Line line is parameterized as follows:
0042 //! P (U) = O + U*Dir
0043 //! where:
0044 //! - P is the point of parameter U,
0045 //! - O is the origin and Dir the unit vector of its positioning axis.
0046 //! The parameter range is ] -infinite, +infinite [.
0047 //! The orientation of the line is given by the unit vector
0048 //! of its positioning axis.
0049 //! See Also
0050 //! GCE2d_MakeLine which provides functions for more
0051 //! complex line constructions
0052 //! gp_Ax2d
0053 //! gp_Lin2d for an equivalent, non-parameterized data structure.
0054 class Geom2d_Line : public Geom2d_Curve
0055 {
0056 
0057 public:
0058 
0059   
0060 
0061   //! Creates a line located in 2D space with the axis placement A.
0062   //! The Location of A is the origin of the line.
0063   Standard_EXPORT Geom2d_Line(const gp_Ax2d& A);
0064   
0065 
0066   //! Creates a line by conversion of the gp_Lin2d line L.
0067   Standard_EXPORT Geom2d_Line(const gp_Lin2d& L);
0068   
0069   //! Constructs a line passing through point P and parallel to
0070   //! vector V (P and V are, respectively, the origin
0071   //! and the unit vector of the positioning axis of the line).
0072   Standard_EXPORT Geom2d_Line(const gp_Pnt2d& P, const gp_Dir2d& V);
0073   
0074 
0075   //! Set <me> so that <me> has the same geometric properties as L.
0076   Standard_EXPORT void SetLin2d (const gp_Lin2d& L);
0077   
0078   //! changes the direction of the line.
0079   Standard_EXPORT void SetDirection (const gp_Dir2d& V);
0080   
0081   //! changes the direction of the line.
0082   Standard_EXPORT const gp_Dir2d& Direction() const;
0083   
0084 
0085   //! Changes the "Location" point (origin) of the line.
0086   Standard_EXPORT void SetLocation (const gp_Pnt2d& P);
0087   
0088 
0089   //! Changes the "Location" point (origin) of the line.
0090   Standard_EXPORT const gp_Pnt2d& Location() const;
0091   
0092 
0093   //! Changes the "Location" and a the "Direction" of <me>.
0094   Standard_EXPORT void SetPosition (const gp_Ax2d& A);
0095   
0096   Standard_EXPORT const gp_Ax2d& Position() const;
0097   
0098 
0099   //! Returns non persistent line from gp with the same geometric
0100   //! properties as <me>
0101   Standard_EXPORT gp_Lin2d Lin2d() const;
0102   
0103   //! Changes the orientation of this line. As a result, the
0104   //! unit vector of the positioning axis of this line is reversed.
0105   Standard_EXPORT void Reverse() Standard_OVERRIDE;
0106   
0107   //! Computes the parameter on the reversed line for the
0108   //! point of parameter U on this line.
0109   //! For a line, the returned value is -U.
0110   Standard_EXPORT Standard_Real ReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
0111   
0112   //! Returns RealFirst  from  Standard.
0113   Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
0114   
0115   //! Returns RealLast  from Standard
0116   Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
0117   
0118   //! Returns False
0119   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
0120   
0121   //! Returns False
0122   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
0123   
0124   //! Returns GeomAbs_CN, which is the global continuity of any line.
0125   Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
0126   
0127   //! Computes the distance between <me> and the point P.
0128   Standard_EXPORT Standard_Real Distance (const gp_Pnt2d& P) const;
0129   
0130   //! Returns True.
0131   Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const Standard_OVERRIDE;
0132   
0133   //! Returns in P the point of parameter U.
0134   //! P (U) = O + U * Dir where O is the "Location" point of the
0135   //! line and Dir the direction of the line.
0136   Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE;
0137   
0138 
0139   //! Returns the point P of parameter u and the first derivative V1.
0140   Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1) const Standard_OVERRIDE;
0141   
0142 
0143   //! Returns the point P of parameter U, the first and second
0144   //! derivatives V1 and V2. V2 is a vector with null magnitude
0145   //! for a line.
0146   Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const Standard_OVERRIDE;
0147   
0148 
0149   //! V2 and V3 are vectors with null magnitude for a line.
0150   Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const Standard_OVERRIDE;
0151   
0152   //! For the point of parameter U of this line, computes
0153   //! the vector corresponding to the Nth derivative.
0154   //! Note: if N is greater than or equal to 2, the result is a
0155   //! vector with null magnitude.
0156   //! Exceptions Standard_RangeError if N is less than 1.
0157   Standard_EXPORT gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
0158   
0159   //! Applies the transformation T to this line.
0160   Standard_EXPORT void Transform (const gp_Trsf2d& T) Standard_OVERRIDE;
0161   
0162   //! Computes the parameter on the line transformed by
0163   //! T for the point of parameter U on this line.
0164   //! For a line, the returned value is equal to U multiplied
0165   //! by the scale factor of transformation T.
0166   Standard_EXPORT virtual Standard_Real TransformedParameter (const Standard_Real U, const gp_Trsf2d& T) const Standard_OVERRIDE;
0167   
0168   //! Returns the coefficient required to compute the
0169   //! parametric transformation of this line when
0170   //! transformation T is applied. This coefficient is the
0171   //! ratio between the parameter of a point on this line
0172   //! and the parameter of the transformed point on the
0173   //! new line transformed by T.
0174   //! For a line, the returned value is the scale factor of the transformation T.
0175   Standard_EXPORT virtual Standard_Real ParametricTransformation (const gp_Trsf2d& T) const Standard_OVERRIDE;
0176   
0177   //! Creates a new object, which is a copy of this line.
0178   Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE;
0179 
0180   //! Dumps the content of me into the stream
0181   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0182 
0183 
0184 
0185 
0186   DEFINE_STANDARD_RTTIEXT(Geom2d_Line,Geom2d_Curve)
0187 
0188 protected:
0189 
0190 
0191 
0192 
0193 private:
0194 
0195 
0196   gp_Ax2d pos;
0197 
0198 
0199 };
0200 
0201 
0202 
0203 
0204 
0205 
0206 
0207 #endif // _Geom2d_Line_HeaderFile