42cf5bc1 |
1 | // Created on: 1991-03-22 |
2 | // Created by: Philippe DAUTRY |
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_Circ2dTanOnRad_HeaderFile |
18 | #define _GccAna_Circ2dTanOnRad_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_Array1OfCirc2d.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 Standard_NegativeValue; |
34 | class Standard_OutOfRange; |
35 | class StdFail_NotDone; |
36 | class GccEnt_BadQualifier; |
37 | class GccEnt_QualifiedCirc; |
38 | class gp_Lin2d; |
39 | class GccEnt_QualifiedLin; |
40 | class gp_Pnt2d; |
41 | class gp_Circ2d; |
42 | |
43 | |
44 | //! This class implements the algorithms used to |
45 | //! create a 2d circle tangent to a 2d entity, |
46 | //! centered on a curv and with a given radius. |
47 | //! The arguments of all construction methods are : |
48 | //! - The qualified element for the tangency constrains |
49 | //! (QualifiedCirc, QualifiedLin, Points). |
50 | //! - The Center element (circle, line). |
51 | //! - A real Tolerance. |
52 | //! Tolerance is only used in the limits cases. |
53 | //! For example : |
54 | //! We want to create a circle tangent to an OutsideCirc C1 |
55 | //! centered on a line OnLine with a radius Radius and with |
56 | //! a tolerance Tolerance. |
57 | //! If we did not use Tolerance it is impossible to |
58 | //! find a solution in the the following case : OnLine is |
59 | //! outside C1. There is no intersection point between C1 |
60 | //! and OnLine. The distance between the line and the |
61 | //! circle is greater than Radius. |
62 | //! With Tolerance we will give a solution if the |
63 | //! distance between C1 and OnLine is lower than or |
64 | //! equal Tolerance. |
65 | class GccAna_Circ2dTanOnRad |
66 | { |
67 | public: |
68 | |
69 | DEFINE_STANDARD_ALLOC |
70 | |
71 | |
72 | //! This methods implements the algorithms used to create |
73 | //! 2d Circles tangent to a circle and centered on a 2d Line |
74 | //! with a given radius. |
75 | //! Tolerance is used to find solution in every limit cases. |
76 | //! For example Tolerance is used in the case of EnclosedCirc when |
77 | //! Radius-R1+dist is greater Tolerance (dist is the distance |
78 | //! between the line and the location of the circ, R1 is the |
79 | //! radius of the circ) because there is no solution. |
80 | //! raises NegativeValue in case of NegativeRadius. |
81 | Standard_EXPORT GccAna_Circ2dTanOnRad(const GccEnt_QualifiedCirc& Qualified1, const gp_Lin2d& OnLine, const Standard_Real Radius, const Standard_Real Tolerance); |
82 | |
83 | //! This methods implements the algorithms used to create |
84 | //! 2d Circles tangent to a 2d Line and centered on a 2d Line |
85 | //! with a given radius. |
86 | //! Tolerance is used to find solution in every limit cases. |
87 | //! raises NegativeValue in case of NegativeRadius. |
88 | Standard_EXPORT GccAna_Circ2dTanOnRad(const GccEnt_QualifiedLin& Qualified1, const gp_Lin2d& OnLine, const Standard_Real Radius, const Standard_Real Tolerance); |
89 | |
90 | //! This methods implements the algorithms used to create |
91 | //! 2d Circles passing through a 2d Point and centered on a |
92 | //! 2d Line with a given radius. |
93 | //! Tolerance is used to find solution in every limit cases. |
94 | Standard_EXPORT GccAna_Circ2dTanOnRad(const gp_Pnt2d& Point1, const gp_Lin2d& OnLine, const Standard_Real Radius, const Standard_Real Tolerance); |
95 | |
96 | //! This methods implements the algorithms used to create |
97 | //! 2d Circles tangent to a circle and centered on a 2d Circle |
98 | //! with a given radius. |
99 | //! Tolerance is used to find solution in every limit cases. |
100 | //! raises NegativeValue in case of NegativeRadius. |
101 | Standard_EXPORT GccAna_Circ2dTanOnRad(const GccEnt_QualifiedCirc& Qualified1, const gp_Circ2d& OnCirc, const Standard_Real Radius, const Standard_Real Tolerance); |
102 | |
103 | //! This methods implements the algorithms used to create |
104 | //! 2d Circles tangent to a 2d Line and centered on a 2d Line |
105 | //! with a given radius. |
106 | //! Tolerance is used to find solution in every limit cases. |
107 | //! raises NegativeValue in case of NegativeRadius. |
108 | Standard_EXPORT GccAna_Circ2dTanOnRad(const GccEnt_QualifiedLin& Qualified1, const gp_Circ2d& OnCirc, const Standard_Real Radius, const Standard_Real Tolerance); |
109 | |
110 | //! This methods implements the algorithms used to create |
111 | //! 2d Circles passing through a 2d Point and centered on a |
112 | //! 2d Line with a given radius. |
113 | //! Tolerance is used to find solution in every limit cases. |
114 | //! raises NegativeValue in case of NegativeRadius. |
115 | Standard_EXPORT GccAna_Circ2dTanOnRad(const gp_Pnt2d& Point1, const gp_Circ2d& OnCirc, const Standard_Real Radius, const Standard_Real Tolerance); |
116 | |
117 | //! Returns true if the construction algorithm does not fail |
118 | //! (even if it finds no solution). |
119 | //! Note: IsDone protects against a failure arising from a |
120 | //! more internal intersection algorithm, which has |
121 | //! reached its numeric limits. |
122 | Standard_EXPORT Standard_Boolean IsDone() const; |
123 | |
124 | //! This method returns the number of circles, representing solutions. |
125 | //! Raises NotDone if the construction algorithm didn't succeed. |
126 | Standard_EXPORT Standard_Integer NbSolutions() const; |
127 | |
128 | //! Returns the solution number Index and raises OutOfRange |
129 | //! exception if Index is greater than the number of solutions. |
130 | //! Be careful: the Index is only a way to get all the |
131 | //! solutions, but is not associated to theses outside the |
132 | //! context of the algorithm-object. |
133 | //! Raises NotDone if the construction algorithm didn't succeed. |
134 | //! It raises OutOfRange if Index is greater than the |
135 | //! number of solutions |
136 | Standard_EXPORT gp_Circ2d ThisSolution (const Standard_Integer Index) const; |
137 | |
138 | //! Returns the qualifier Qualif1 of the tangency argument |
139 | //! for the solution of index Index computed by this algorithm. |
140 | //! The returned qualifier is: |
141 | //! - that specified at the start of construction when the |
142 | //! solutions are defined as enclosed, enclosing or |
143 | //! outside with respect to the argument, or |
144 | //! - that computed during construction (i.e. enclosed, |
145 | //! enclosing or outside) when the solutions are defined |
146 | //! as unqualified with respect to the argument, or |
147 | //! - GccEnt_noqualifier if the tangency argument is a point. |
148 | //! Exceptions |
149 | //! Standard_OutOfRange if Index is less than zero or |
150 | //! greater than the number of solutions computed by this algorithm. |
151 | //! StdFail_NotDone if the construction fails. |
152 | Standard_EXPORT void WhichQualifier (const Standard_Integer Index, GccEnt_Position& Qualif1) const; |
153 | |
154 | //! Returns informations about the tangency point between the |
155 | //! result number Index and the first argument. |
156 | //! ParSol is the intrinsic parameter of the point on the |
157 | //! solution curv. |
158 | //! ParArg is the intrinsic parameter of the point on the |
159 | //! argument curv. |
160 | //! PntSol is the tangency point on the solution curv. |
161 | //! PntArg is the tangency point on the argument curv. |
162 | //! Raises NotDone if the construction algorithm didn't succeed. |
163 | //! It raises OutOfRange if Index is greater than the |
164 | //! number of solutions. |
165 | Standard_EXPORT void Tangency1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; |
166 | |
167 | //! Returns informations about the center (on the curv) |
168 | //! of the result. |
169 | //! ParArg is the intrinsic parameter of the point on |
170 | //! the argument curv. |
171 | //! PntSol is the center point of the solution curv. |
172 | //! Raises NotDone if the construction algorithm didn't succeed. |
173 | //! It raises OutOfRange if Index is greater than the |
174 | //! number of solutions. |
175 | Standard_EXPORT void CenterOn3 (const Standard_Integer Index, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; |
176 | |
177 | //! Returns True if the solution number Index is equal to |
178 | //! the first argument and False in the other cases. |
179 | //! Raises NotDone if the construction algorithm didn't succeed. |
180 | //! It raises OutOfRange if Index is greater than the |
181 | //! number of solutions. |
182 | Standard_EXPORT Standard_Boolean IsTheSame1 (const Standard_Integer Index) const; |
183 | |
184 | |
185 | |
186 | |
187 | protected: |
188 | |
189 | |
190 | |
191 | |
192 | |
193 | private: |
194 | |
195 | |
196 | |
197 | Standard_Boolean WellDone; |
198 | Standard_Integer NbrSol; |
199 | TColgp_Array1OfCirc2d cirsol; |
200 | GccEnt_Array1OfPosition qualifier1; |
201 | TColStd_Array1OfInteger TheSame1; |
202 | TColgp_Array1OfPnt2d pnttg1sol; |
203 | TColgp_Array1OfPnt2d pntcen3; |
204 | TColStd_Array1OfReal par1sol; |
205 | TColStd_Array1OfReal pararg1; |
206 | TColStd_Array1OfReal parcen3; |
207 | |
208 | |
209 | }; |
210 | |
211 | |
212 | |
213 | |
214 | |
215 | |
216 | |
217 | #endif // _GccAna_Circ2dTanOnRad_HeaderFile |