Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:17:30

0001 // Created on: 1992-08-26
0002 // Created by: Remi GILET
0003 // Copyright (c) 1992-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 _gce_MakeLin2d_HeaderFile
0018 #define _gce_MakeLin2d_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <gp_Lin2d.hxx>
0025 #include <gce_Root.hxx>
0026 class gp_Ax2d;
0027 class gp_Pnt2d;
0028 class gp_Dir2d;
0029 
0030 //! This class implements construction algorithms for `gp_Lin2d`.
0031 //! Supported constructions include:
0032 //! - line from axis placement;
0033 //! - line from point and direction;
0034 //! - line from cartesian equation;
0035 //! - parallel line through point or at signed distance;
0036 //! - line through two points.
0037 class gce_MakeLin2d : public gce_Root
0038 {
0039 public:
0040   DEFINE_STANDARD_ALLOC
0041 
0042   //! Creates a line located with A.
0043   //! @note The location of `A` is the line origin.
0044   //! @param[in] A local coordinate system
0045   Standard_EXPORT gce_MakeLin2d(const gp_Ax2d& A);
0046 
0047   //! <P> is the location point (origin) of the line and
0048   //! <V> is the direction of the line.
0049   //! @param[in] P point
0050   //! @param[in] V direction vector
0051   Standard_EXPORT gce_MakeLin2d(const gp_Pnt2d& P, const gp_Dir2d& V);
0052 
0053   //! Creates the line from the equation A*X + B*Y + C = 0.0
0054   //! @note Construction fails with `gce_NullAxis` if
0055   //!       `A*A + B*B <= gp::Resolution()`.
0056   //! @param[in] A equation coefficient A
0057   //! @param[in] B equation coefficient B
0058   //! @param[in] C equation coefficient C
0059   Standard_EXPORT gce_MakeLin2d(const double A, const double B, const double C);
0060 
0061   //! Creates a line parallel to input line at signed distance.
0062   //! @note If `Dist` is positive, the result is on the right side
0063   //!       of `Lin` (in line local orientation), otherwise on the left.
0064   //! @param[in] Lin source line
0065   //! @param[in] Dist signed distance
0066   Standard_EXPORT gce_MakeLin2d(const gp_Lin2d& Lin, const double Dist);
0067 
0068   //! Creates a line parallel to input line and passing through a point.
0069   //! @param[in] Lin source line
0070   //! @param[in] Point reference point
0071   Standard_EXPORT gce_MakeLin2d(const gp_Lin2d& Lin, const gp_Pnt2d& Point);
0072 
0073   //! Creates a line passing through two points.
0074   //! @note Construction fails with `gce_ConfusedPoints` if `P1` and `P2`
0075   //!       are coincident.
0076   //! @param[in] P1 first point
0077   //! @param[in] P2 second point
0078   Standard_EXPORT gce_MakeLin2d(const gp_Pnt2d& P1, const gp_Pnt2d& P2);
0079 
0080   //! Returns the constructed line.
0081   //! Exceptions StdFail_NotDone if no line is constructed.
0082   //! @return resulting line
0083   Standard_EXPORT const gp_Lin2d& Value() const;
0084 
0085   //! Alias for Value() returning a copy.
0086   //! @return resulting object
0087   gp_Lin2d Operator() const { return Value(); }
0088 
0089   //! Conversion operator returning the constructed object.
0090   //! @return resulting object
0091   operator gp_Lin2d() const { return Operator(); }
0092 
0093 private:
0094   gp_Lin2d TheLin2d;
0095 };
0096 
0097 #endif // _gce_MakeLin2d_HeaderFile