Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/Geom2d_Line.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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