42cf5bc1 |
1 | // Created on: 1991-04-03 |
2 | // Created by: Remi GILET |
3 | // Copyright (c) 1991-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 _GccAna_Lin2d2Tan_HeaderFile |
18 | #define _GccAna_Lin2d2Tan_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Standard_Integer.hxx> |
26 | #include <TColgp_Array1OfLin2d.hxx> |
27 | #include <GccEnt_Array1OfPosition.hxx> |
28 | #include <TColgp_Array1OfPnt2d.hxx> |
29 | #include <TColStd_Array1OfReal.hxx> |
30 | #include <Standard_Real.hxx> |
31 | #include <GccEnt_Position.hxx> |
32 | class Standard_OutOfRange; |
33 | class GccEnt_BadQualifier; |
34 | class StdFail_NotDone; |
35 | class gp_Pnt2d; |
36 | class GccEnt_QualifiedCirc; |
37 | class gp_Lin2d; |
38 | |
39 | |
40 | //! This class implements the algorithms used to |
41 | //! create 2d lines tangent to 2 other elements which |
42 | //! can be circles or points. |
43 | //! Describes functions for building a 2D line: |
44 | //! - tangential to 2 circles, or |
45 | //! - tangential to a circle and passing through a point, or |
46 | //! - passing through 2 points. |
47 | //! A Lin2d2Tan object provides a framework for: |
48 | //! - defining the construction of 2D line(s), |
49 | //! - implementing the construction algorithm, and |
50 | //! consulting the result(s). |
51 | //! Some constructors may check the type of the qualified argument |
52 | //! and raise BadQualifier Error in case of incorrect couple (qualifier, |
53 | //! curv). |
54 | //! For example: "EnclosedCirc". |
55 | class GccAna_Lin2d2Tan |
56 | { |
57 | public: |
58 | |
59 | DEFINE_STANDARD_ALLOC |
60 | |
61 | |
62 | //! This methods implements the algorithms used to |
63 | //! create 2d lines passing thrue 2 points. |
64 | //! Tolerance is used because we can't create a line |
65 | //! when the distance between the two points is too small. |
66 | Standard_EXPORT GccAna_Lin2d2Tan(const gp_Pnt2d& ThePoint1, const gp_Pnt2d& ThePoint2, const Standard_Real Tolerance); |
67 | |
68 | //! This methods implements the algorithms used to |
69 | //! create 2d lines tangent to one circle and passing |
70 | //! thrue a point. |
71 | //! Exception BadQualifier is raised in the case of |
72 | //! EnclosedCirc |
73 | //! Tolerance is used because there is no solution |
74 | //! when the point is inside the solution according to |
75 | //! the tolerance. |
76 | Standard_EXPORT GccAna_Lin2d2Tan(const GccEnt_QualifiedCirc& Qualified1, const gp_Pnt2d& ThePoint, const Standard_Real Tolerance); |
77 | |
78 | //! This methods implements the algorithms used to |
79 | //! create 2d lines tangent to 2 circles. |
80 | //! Exception BadQualifier is raised in the case of |
81 | //! EnclosedCirc |
82 | Standard_EXPORT GccAna_Lin2d2Tan(const GccEnt_QualifiedCirc& Qualified1, const GccEnt_QualifiedCirc& Qualified2, const Standard_Real Tolerance); |
83 | |
84 | //! This method returns true when there is a solution |
85 | //! and false in the other cases. |
86 | Standard_EXPORT Standard_Boolean IsDone() const; |
87 | |
88 | //! This method returns the number of solutions. |
89 | //! Raises NotDone if the construction algorithm didn't succeed. |
90 | Standard_EXPORT Standard_Integer NbSolutions() const; |
91 | |
92 | //! Returns the solution number Index and raises OutOfRange |
93 | //! exception if Index is greater than the number of solutions. |
94 | //! Be carefull: the Index is only a way to get all the |
95 | //! solutions, but is not associated to theses outside the |
96 | //! context of the algorithm-object. Raises OutOfRange is raised if Index is greater than |
97 | //! the number of solutions. |
98 | //! It raises NotDone if the algorithm failed. |
99 | Standard_EXPORT gp_Lin2d ThisSolution (const Standard_Integer Index) const; |
100 | |
101 | //! Returns the qualifiers Qualif1 and Qualif2 of the |
102 | //! tangency arguments for the solution of index Index |
103 | //! computed by this algorithm. |
104 | //! The returned qualifiers are: |
105 | //! - those specified at the start of construction when the |
106 | //! solutions are defined as enclosing or outside with |
107 | //! respect to the arguments, or |
108 | //! - those computed during construction (i.e. enclosing or |
109 | //! outside) when the solutions are defined as unqualified |
110 | //! with respect to the arguments, or |
111 | //! - GccEnt_noqualifier if the tangency argument is a point. |
112 | //! Exceptions |
113 | //! Standard_OutOfRange if Index is less than zero or |
114 | //! greater than the number of solutions computed by this algorithm. |
115 | //! StdFail_NotDone if the construction fails. |
116 | Standard_EXPORT void WhichQualifier (const Standard_Integer Index, GccEnt_Position& Qualif1, GccEnt_Position& Qualif2) const; |
117 | |
118 | //! Returns informations about the tangency point between the |
119 | //! result number Index and the first argument. |
120 | //! ParSol is the intrinsic parameter of the point PntSol on |
121 | //! the solution curv. |
122 | //! ParArg is the intrinsic parameter of the point PntSol on |
123 | //! the argument curv. Raises OutOfRange is raised if Index is greater than |
124 | //! the number of solutions. |
125 | //! It raises NotDone if the algorithm failed. |
126 | Standard_EXPORT void Tangency1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; |
127 | |
128 | //! Returns informations about the tangency point between the |
129 | //! result number Index and the second argument. |
130 | //! ParSol is the intrinsic parameter of the point ParSol on |
131 | //! the solution curv. |
132 | //! ParArg is the intrinsic parameter of the point PntSol on |
133 | //! the argument curv. Raises OutOfRange is raised if Index is greater than |
134 | //! the number of solutions. |
135 | //! It raises NotDone if the algorithm failed. |
136 | Standard_EXPORT void Tangency2 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; |
137 | |
138 | |
139 | |
140 | |
141 | protected: |
142 | |
143 | |
144 | |
145 | |
146 | |
147 | private: |
148 | |
149 | |
150 | |
151 | Standard_Boolean WellDone; |
152 | Standard_Integer NbrSol; |
153 | TColgp_Array1OfLin2d linsol; |
154 | GccEnt_Array1OfPosition qualifier1; |
155 | GccEnt_Array1OfPosition qualifier2; |
156 | TColgp_Array1OfPnt2d pnttg1sol; |
157 | TColgp_Array1OfPnt2d pnttg2sol; |
158 | TColStd_Array1OfReal par1sol; |
159 | TColStd_Array1OfReal par2sol; |
160 | TColStd_Array1OfReal pararg1; |
161 | TColStd_Array1OfReal pararg2; |
162 | |
163 | |
164 | }; |
165 | |
166 | |
167 | |
168 | |
169 | |
170 | |
171 | |
172 | #endif // _GccAna_Lin2d2Tan_HeaderFile |