1 // Created on: 1992-08-26
2 // Created by: Remi GILET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _gce_MakeLin2d_HeaderFile
18 #define _gce_MakeLin2d_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <gp_Lin2d.hxx>
25 #include <gce_Root.hxx>
26 #include <Standard_Real.hxx>
27 class StdFail_NotDone;
34 //! This class implements the following algorithms used
35 //! to create Lin2d from gp.
37 //! * Create a Lin2d parallel to another and passing
39 //! * Create a Lin2d parallel to another at the distance
41 //! * Create a Lin2d passing through 2 points.
42 //! * Create a Lin2d from its axis (Ax1 from gp).
43 //! * Create a Lin2d from a point and a direction.
44 //! * Create a Lin2d from its equation.
45 class gce_MakeLin2d : public gce_Root
52 //! Creates a line located with A.
53 Standard_EXPORT gce_MakeLin2d(const gp_Ax2d& A);
56 //! <P> is the location point (origin) of the line and
57 //! <V> is the direction of the line.
58 Standard_EXPORT gce_MakeLin2d(const gp_Pnt2d& P, const gp_Dir2d& V);
61 //! Creates the line from the equation A*X + B*Y + C = 0.0
62 //! the status is "NullAxis"if Sqrt(A*A + B*B) <= Resolution from gp.
63 Standard_EXPORT gce_MakeLin2d(const Standard_Real A, const Standard_Real B, const Standard_Real C);
65 //! Make a Lin2d from gp <TheLin> parallel to another
66 //! Lin2d <Lin> at a distance <Dist>.
67 //! If Dist is greater than zero the result is on the
68 //! right of the Line <Lin>, else the result is on the
69 //! left of the Line <Lin>.
70 Standard_EXPORT gce_MakeLin2d(const gp_Lin2d& Lin, const Standard_Real Dist);
72 //! Make a Lin2d from gp <TheLin> parallel to another
73 //! Lin2d <Lin> and passing through a Pnt2d <Point>.
74 Standard_EXPORT gce_MakeLin2d(const gp_Lin2d& Lin, const gp_Pnt2d& Point);
76 //! Make a Lin2d from gp <TheLin> passing through 2
78 //! It returns false if <P1> and <P2> are confused.
80 //! If an error occurs (that is, when IsDone returns
81 //! false), the Status function returns:
82 //! - gce_NullAxis if Sqrt(A*A + B*B) is less
83 //! than or equal to gp::Resolution(), or
84 //! - gce_ConfusedPoints if points P1 and P2 are coincident.
85 Standard_EXPORT gce_MakeLin2d(const gp_Pnt2d& P1, const gp_Pnt2d& P2);
87 //! Returns the constructed line.
88 //! Exceptions StdFail_NotDone if no line is constructed.
89 Standard_EXPORT gp_Lin2d Value() const;
91 Standard_EXPORT gp_Lin2d Operator() const;
92 Standard_EXPORT operator gp_Lin2d() const;
118 #endif // _gce_MakeLin2d_HeaderFile