42cf5bc1 |
1 | // Created on: 1992-10-20 |
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 _Geom2dGcc_Circ2d2TanOn_HeaderFile |
18 | #define _Geom2dGcc_Circ2d2TanOn_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | #include <TColgp_Array1OfCirc2d.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | #include <GccEnt_Array1OfPosition.hxx> |
28 | #include <TColStd_Array1OfInteger.hxx> |
29 | #include <TColgp_Array1OfPnt2d.hxx> |
30 | #include <TColStd_Array1OfReal.hxx> |
31 | #include <Standard_Real.hxx> |
32 | #include <GccEnt_Position.hxx> |
33 | class StdFail_NotDone; |
34 | class GccEnt_BadQualifier; |
35 | class Standard_OutOfRange; |
36 | class Geom2dGcc_QualifiedCurve; |
37 | class Geom2dAdaptor_Curve; |
38 | class Geom2d_Point; |
39 | class GccAna_Circ2d2TanOn; |
40 | class Geom2dGcc_Circ2d2TanOnGeo; |
41 | class gp_Circ2d; |
42 | class gp_Pnt2d; |
43 | |
44 | |
45 | //! This class implements the algorithms used to |
46 | //! create 2d circles TANgent to 2 entities and |
47 | //! having the center ON a curve. |
48 | //! The order of the tangency argument is always |
49 | //! QualifiedCirc, QualifiedLin, QualifiedCurv, Pnt2d. |
50 | //! the arguments are : |
51 | //! - The two tangency arguments. |
52 | //! - The center line. |
53 | //! - The parameter for each tangency argument which |
54 | //! is a curve. |
55 | //! - The tolerance. |
56 | class Geom2dGcc_Circ2d2TanOn |
57 | { |
58 | public: |
59 | |
60 | DEFINE_STANDARD_ALLOC |
61 | |
62 | |
63 | //! This method implements the algorithms used to |
64 | //! create 2d circles TANgent to two curves and |
65 | //! having the center ON a 2d curve. |
66 | //! Param1 is the initial guess on the first curve QualifiedCurv. |
67 | //! Param1 is the initial guess on the second curve QualifiedCurv. |
68 | //! ParamOn is the initial guess on the center curve OnCurv. |
69 | //! Tolerance is used for the limit cases. |
70 | Standard_EXPORT Geom2dGcc_Circ2d2TanOn(const Geom2dGcc_QualifiedCurve& Qualified1, const Geom2dGcc_QualifiedCurve& Qualified2, const Geom2dAdaptor_Curve& OnCurve, const Standard_Real Tolerance, const Standard_Real Param1, const Standard_Real Param2, const Standard_Real ParamOn); |
71 | |
72 | //! This method implements the algorithms used to |
73 | //! create 2d circles TANgent to one curve and one point and |
74 | //! having the center ON a 2d curve. |
75 | //! Param1 is the initial guess on the first curve QualifiedCurv. |
76 | //! ParamOn is the initial guess on the center curve OnCurv. |
77 | //! Tolerance is used for the limit cases. |
78 | Standard_EXPORT Geom2dGcc_Circ2d2TanOn(const Geom2dGcc_QualifiedCurve& Qualified1, const Handle(Geom2d_Point)& Point, const Geom2dAdaptor_Curve& OnCurve, const Standard_Real Tolerance, const Standard_Real Param1, const Standard_Real ParamOn); |
79 | |
80 | //! This method implements the algorithms used to |
81 | //! create 2d circles TANgent to two points and |
82 | //! having the center ON a 2d curve. |
83 | //! Tolerance is used for the limit cases. |
84 | Standard_EXPORT Geom2dGcc_Circ2d2TanOn(const Handle(Geom2d_Point)& Point1, const Handle(Geom2d_Point)& Point2, const Geom2dAdaptor_Curve& OnCurve, const Standard_Real Tolerance); |
85 | |
86 | Standard_EXPORT void Results (const GccAna_Circ2d2TanOn& Circ); |
87 | |
88 | Standard_EXPORT void Results (const Geom2dGcc_Circ2d2TanOnGeo& Circ); |
89 | |
90 | //! Returns true if the construction algorithm does not fail |
91 | //! (even if it finds no solution). |
92 | //! Note: IsDone protects against a failure arising from a |
93 | //! more internal intersection algorithm, which has |
94 | //! reached its numeric limits. |
95 | Standard_EXPORT Standard_Boolean IsDone() const; |
96 | |
97 | //! This method returns the number of solutions. |
98 | //! NotDone is raised if the algorithm failed. |
99 | Standard_EXPORT Standard_Integer NbSolutions() const; |
100 | |
101 | //! Returns the solution number Index and raises OutOfRange |
102 | //! exception if Index is greater than the number of solutions. |
103 | //! Be carefull: the Index is only a way to get all the |
104 | //! solutions, but is not associated to theses outside the context |
105 | //! of the algorithm-object. |
106 | //! Exceptions |
107 | //! Standard_OutOfRange if Index is less than or equal |
108 | //! to zero or greater than the number of solutions |
109 | //! computed by this algorithm. |
110 | //! StdFail_NotDone if the construction fails. |
111 | Standard_EXPORT gp_Circ2d ThisSolution (const Standard_Integer Index) const; |
112 | |
113 | //! It returns the informations about the qualifiers of |
114 | //! the tangency |
115 | //! arguments concerning the solution number Index. |
116 | //! It returns the real qualifiers (the qualifiers given to the |
117 | //! constructor method in case of enclosed, enclosing and outside |
118 | //! and the qualifiers computedin case of unqualified). |
119 | //! Exceptions |
120 | //! Standard_OutOfRange if Index is less than zero or |
121 | //! greater than the number of solutions computed by this algorithm. |
122 | //! StdFail_NotDone if the construction fails. |
123 | Standard_EXPORT void WhichQualifier (const Standard_Integer Index, GccEnt_Position& Qualif1, GccEnt_Position& Qualif2) const; |
124 | |
125 | //! Returns informations about the tangency point between the |
126 | //! result and the first argument. |
127 | //! ParSol is the intrinsic parameter of the point PntSol on the solution curv. |
128 | //! ParArg is the intrinsic parameter of the point PntSol on the argument curv. |
129 | Standard_EXPORT void Tangency1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; |
130 | |
131 | //! Returns informations about the tangency point between the |
132 | //! result and the second argument. |
133 | //! ParSol is the intrinsic parameter of the point PntSol on the solution curv. |
134 | //! ParArg is the intrinsic parameter of the point PntSol on the argument curv. |
135 | Standard_EXPORT void Tangency2 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; |
136 | |
137 | //! Returns the center PntSol of the solution of index Index |
138 | //! computed by this algorithm. |
139 | //! ParArg is the parameter of the point PntSol on the third argument. |
140 | //! Exceptions |
141 | //! Standard_OutOfRange if Index is less than zero or |
142 | //! greater than the number of solutions computed by this algorithm. |
143 | //! StdFail_NotDone if the construction fails. |
144 | Standard_EXPORT void CenterOn3 (const Standard_Integer Index, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; |
145 | |
146 | //! Returns true if the solution of index Index and, |
147 | //! respectively, the first or second argument of this |
148 | //! algorithm are the same (i.e. there are 2 identical circles). |
149 | //! If Rarg is the radius of the first or second argument, |
150 | //! Rsol is the radius of the solution and dist is the |
151 | //! distance between the two centers, we consider the two |
152 | //! circles to be identical if |Rarg - Rsol| and dist |
153 | //! are less than or equal to the tolerance criterion given at |
154 | //! the time of construction of this algorithm. |
155 | //! Exceptions |
156 | //! Standard_OutOfRange if Index is less than zero or |
157 | //! greater than the number of solutions computed by this algorithm. |
158 | //! StdFail_NotDone if the construction fails. |
159 | Standard_EXPORT Standard_Boolean IsTheSame1 (const Standard_Integer Index) const; |
160 | |
161 | //! Returns true if the solution of index Index and, |
162 | //! respectively, the first or second argument of this |
163 | //! algorithm are the same (i.e. there are 2 identical circles). |
164 | //! If Rarg is the radius of the first or second argument, |
165 | //! Rsol is the radius of the solution and dist is the |
166 | //! distance between the two centers, we consider the two |
167 | //! circles to be identical if |Rarg - Rsol| and dist |
168 | //! are less than or equal to the tolerance criterion given at |
169 | //! the time of construction of this algorithm. |
170 | //! Exceptions |
171 | //! Standard_OutOfRange if Index is less than zero or |
172 | //! greater than the number of solutions computed by this algorithm. |
173 | //! StdFail_NotDone if the construction fails. |
174 | Standard_EXPORT Standard_Boolean IsTheSame2 (const Standard_Integer Index) const; |
175 | |
176 | |
177 | |
178 | |
179 | protected: |
180 | |
181 | |
182 | |
183 | |
184 | |
185 | private: |
186 | |
187 | |
188 | |
189 | Standard_Boolean WellDone; |
190 | TColgp_Array1OfCirc2d cirsol; |
191 | Standard_Integer NbrSol; |
192 | GccEnt_Array1OfPosition qualifier1; |
193 | GccEnt_Array1OfPosition qualifier2; |
194 | TColStd_Array1OfInteger TheSame1; |
195 | TColStd_Array1OfInteger TheSame2; |
196 | TColgp_Array1OfPnt2d pnttg1sol; |
197 | TColgp_Array1OfPnt2d pnttg2sol; |
198 | TColgp_Array1OfPnt2d pntcen; |
199 | TColStd_Array1OfReal par1sol; |
200 | TColStd_Array1OfReal par2sol; |
201 | TColStd_Array1OfReal pararg1; |
202 | TColStd_Array1OfReal pararg2; |
203 | TColStd_Array1OfReal parcen3; |
204 | Standard_Boolean Invert; |
205 | |
206 | |
207 | }; |
208 | |
209 | |
210 | |
211 | |
212 | |
213 | |
214 | |
215 | #endif // _Geom2dGcc_Circ2d2TanOn_HeaderFile |