42cf5bc1 |
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 |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _gce_MakeLin2d_HeaderFile |
18 | #define _gce_MakeLin2d_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <gp_Lin2d.hxx> |
25 | #include <gce_Root.hxx> |
26 | #include <Standard_Real.hxx> |
27 | class StdFail_NotDone; |
28 | class gp_Ax2d; |
29 | class gp_Pnt2d; |
30 | class gp_Dir2d; |
31 | class gp_Lin2d; |
32 | |
33 | |
34 | //! This class implements the following algorithms used |
35 | //! to create Lin2d from gp. |
36 | //! |
37 | //! * Create a Lin2d parallel to another and passing |
38 | //! through a point. |
39 | //! * Create a Lin2d parallel to another at the distance |
40 | //! Dist. |
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 |
46 | { |
47 | public: |
48 | |
49 | DEFINE_STANDARD_ALLOC |
50 | |
51 | |
52 | //! Creates a line located with A. |
53 | Standard_EXPORT gce_MakeLin2d(const gp_Ax2d& A); |
54 | |
55 | |
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); |
59 | |
60 | |
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); |
64 | |
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); |
71 | |
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); |
75 | |
76 | //! Make a Lin2d from gp <TheLin> passing through 2 |
77 | //! Pnt2d <P1>,<P2>. |
78 | //! It returns false if <P1> and <P2> are confused. |
79 | //! Warning |
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); |
86 | |
87 | //! Returns the constructed line. |
88 | //! Exceptions StdFail_NotDone if no line is constructed. |
89 | Standard_EXPORT gp_Lin2d Value() const; |
90 | |
91 | Standard_EXPORT gp_Lin2d Operator() const; |
92 | Standard_EXPORT operator gp_Lin2d() const; |
93 | |
94 | |
95 | |
96 | |
97 | protected: |
98 | |
99 | |
100 | |
101 | |
102 | |
103 | private: |
104 | |
105 | |
106 | |
107 | gp_Lin2d TheLin2d; |
108 | |
109 | |
110 | }; |
111 | |
112 | |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | #endif // _gce_MakeLin2d_HeaderFile |