1 -- Created on: 1992-10-20
2 -- Created by: Remi GILET
3 -- Copyright (c) 1992-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
22 class Circ2d2TanRad from Geom2dGcc
24 ---Purpose: This class implements the algorithms used to
25 -- create 2d circles tangent to one curve and a
26 -- point/line/circle/curv and with a given radius.
27 -- For each construction methods arguments are:
28 -- - Two Qualified elements for tangency constrains.
29 -- (for example EnclosedCirc if we want the
30 -- solution inside the argument EnclosedCirc).
31 -- - Two Reals. One (Radius) for the radius and the
32 -- other (Tolerance) for the tolerance.
33 -- Tolerance is only used for the limit cases.
35 -- We want to create a circle inside a circle C1 and
36 -- inside a curve Cu2 with a radius Radius and a
37 -- tolerance Tolerance.
38 -- If we did not used Tolerance it is impossible to
39 -- find a solution in the the following case : Cu2 is
40 -- inside C1 and there is no intersection point
41 -- between the two elements.
42 -- with Tolerance we will give a solution if the
43 -- lowest distance between C1 and Cu2 is lower than or
46 -- inherits Entity from Standard
48 uses QualifiedCurve from Geom2dGcc,
49 Integer from Standard,
50 Boolean from Standard,
54 Array1OfPnt2d from TColgp,
55 Array1OfCirc2d from TColgp,
56 Array1OfInteger from TColStd,
57 Array1OfReal from TColStd,
58 Circ2d2TanRad from GccAna,
59 MyCirc2d2TanRad from Geom2dGcc,
61 Array1OfPosition from GccEnt
63 raises OutOfRange from Standard,
64 BadQualifier from GccEnt,
66 NegativeValue from Standard
70 Create(Qualified1 : QualifiedCurve from Geom2dGcc ;
71 Qualified2 : QualifiedCurve from Geom2dGcc ;
72 Radius : Real from Standard ;
73 Tolerance : Real from Standard )
74 returns Circ2d2TanRad from Geom2dGcc
75 raises BadQualifier, NegativeValue;
77 Create(Qualified1 : QualifiedCurve from Geom2dGcc ;
78 Point : Point from Geom2d ;
79 Radius : Real from Standard ;
80 Tolerance : Real from Standard )
81 returns Circ2d2TanRad from Geom2dGcc
82 raises BadQualifier, NegativeValue;
84 Create(Point1 : Point from Geom2d ;
85 Point2 : Point from Geom2d ;
86 Radius : Real from Standard ;
87 Tolerance : Real from Standard )
88 returns Circ2d2TanRad from Geom2dGcc
91 ---Purpose: These constructors create one or more 2D circles of radius Radius either
92 -- - tangential to the 2 curves Qualified1 and Qualified2, or
93 -- - tangential to the curve Qualified1 and passing through the point Point, or
94 -- - passing through two points Point1 and Point2.
95 -- Tolerance is a tolerance criterion used by the algorithm
96 -- to find a solution when, mathematically, the problem
97 -- posed does not have a solution, but where there is
98 -- numeric uncertainty attached to the arguments.
99 -- For example, take two circles C1 and C2, such that C2
100 -- is inside C1, and almost tangential to C1. There is, in
101 -- fact, no point of intersection between C1 and C2. You
102 -- now want to find a circle of radius R (smaller than the
103 -- radius of C2), which is tangential to C1 and C2, and
104 -- inside these two circles: a pure mathematical resolution
105 -- will not find a solution. This is where the tolerance
106 -- criterion is used: the algorithm considers that C1 and
107 -- C2 are tangential if the shortest distance between these
108 -- two circles is less than or equal to Tolerance. Thus, a
109 -- solution is found by the algorithm.
111 -- GccEnt_BadQualifier if a qualifier is inconsistent with
112 -- the argument it qualifies (for example, enclosing for a line).
113 -- Standard_NegativeValue if Radius is negative.
116 Results(me : in out ;
117 Circ : Circ2d2TanRad from GccAna)
120 Results(me : in out ;
121 Circ : MyCirc2d2TanRad from Geom2dGcc)
124 IsDone(me) returns Boolean from Standard
126 ---Purpose: This method returns True if the algorithm succeeded.
127 -- Note: IsDone protects against a failure arising from a
128 -- more internal intersection algorithm, which has reached its numeric limits.
130 NbSolutions(me) returns Integer from Standard
133 ---Purpose: This method returns the number of solutions.
134 -- NotDone is raised if the algorithm failed.
136 -- StdFail_NotDone if the construction fails.
138 ThisSolution(me ; Index : Integer from Standard) returns Circ2d from gp
139 raises OutOfRange, NotDone
141 ---Purpose: Returns the solution number Index and raises OutOfRange
142 -- exception if Index is greater than the number of solutions.
143 -- Be carefull: the Index is only a way to get all the
144 -- solutions, but is not associated to theses outside the context of the algorithm-object.
146 -- This indexing simply provides a means of consulting the
147 -- solutions. The index values are not associated with
148 -- these solutions outside the context of the algorithm object.
150 -- Standard_OutOfRange if Index is less than zero or
151 -- greater than the number of solutions computed by this algorithm.
152 -- StdFail_NotDone if the construction fails.
155 Index : Integer from Standard;
156 Qualif1 : out Position from GccEnt ;
157 Qualif2 : out Position from GccEnt )
158 raises OutOfRange, NotDone
160 ---Purpose: Returns the qualifiers Qualif1 and Qualif2 of the
161 -- tangency arguments for the solution of index Index
162 -- computed by this algorithm.
163 -- The returned qualifiers are:
164 -- - those specified at the start of construction when the
165 -- solutions are defined as enclosed, enclosing or
166 -- outside with respect to the arguments, or
167 -- - those computed during construction (i.e. enclosed,
168 -- enclosing or outside) when the solutions are defined
169 -- as unqualified with respect to the arguments, or
170 -- - GccEnt_noqualifier if the tangency argument is a point, or
171 -- - GccEnt_unqualified in certain limit cases where it
172 -- is impossible to qualify the solution as enclosed, enclosing or outside.
174 -- Standard_OutOfRange if Index is less than zero or
175 -- greater than the number of solutions computed by this algorithm.
176 -- StdFail_NotDone if the construction fails.
179 Index : Integer from Standard;
180 ParSol,ParArg : out Real from Standard;
181 PntSol : out Pnt2d from gp )
182 raises OutOfRange, NotDone
184 ---Purpose: Returns informations about the tangency point between the
185 -- result number Index and the first argument.
186 -- ParSol is the intrinsic parameter of the point PntSol on the solution curv.
187 -- ParArg is the intrinsic parameter of the point PntSol on the argument curv.
188 -- OutOfRange is raised if Index is greater than the number of solutions.
189 -- notDone is raised if the construction algorithm did not succeed.
192 Index : Integer from Standard;
193 ParSol,ParArg : out Real from Standard;
194 PntSol : out Pnt2d from gp )
195 raises OutOfRange, NotDone
197 ---Purpose: Returns informations about the tangency point between the
198 -- result number Index and the second argument.
199 -- ParSol is the intrinsic parameter of the point PntSol on the solution curv.
200 -- ParArg is the intrinsic parameter of the point PntSol on the argument curv.
201 -- OutOfRange is raised if Index is greater than the number of solutions.
202 -- notDone is raised if the construction algorithm did not succeed.
205 Index : Integer from Standard) returns Boolean from Standard
206 raises OutOfRange, NotDone
208 ---Purpose: Returns true if the solution of index Index and,
209 -- respectively, the first or second argument of this
210 -- algorithm are the same (i.e. there are 2 identical circles).
211 -- If Rarg is the radius of the first or second argument,
212 -- Rsol is the radius of the solution and dist is the
213 -- distance between the two centers, we consider the two
214 -- circles to be identical if |Rarg - Rsol| and dist
215 -- are less than or equal to the tolerance criterion given at
216 -- the time of construction of this algorithm.
217 -- OutOfRange is raised if Index is greater than the number of solutions.
218 -- notDone is raised if the construction algorithm did not succeed.
221 Index : Integer from Standard ) returns Boolean from Standard
222 raises OutOfRange, NotDone
224 ---Purpose: Returns true if the solution of index Index and,
225 -- respectively, the first or second argument of this
226 -- algorithm are the same (i.e. there are 2 identical circles).
227 -- If Rarg is the radius of the first or second argument,
228 -- Rsol is the radius of the solution and dist is the
229 -- distance between the two centers, we consider the two
230 -- circles to be identical if |Rarg - Rsol| and dist
231 -- are less than or equal to the tolerance criterion given at
232 -- the time of construction of this algorithm.
233 -- OutOfRange is raised if Index is greater than the number of solutions.
234 -- notDone is raised if the construction algorithm did not succeed.
238 WellDone : Boolean from Standard;
239 ---Purpose: Returns True if the algorithm succeeded.
241 cirsol : Array1OfCirc2d from TColgp;
242 ---Purpose: TheSolution.
244 NbrSol : Integer from Standard;
245 ---Purpose: Returns the number of solutions.
247 qualifier1 : Array1OfPosition from GccEnt;
248 ---Purpose: The qualifiers of the first argument.
250 qualifier2 : Array1OfPosition from GccEnt;
251 ---Purpose: The qualifiers of the second argument.
253 TheSame1 : Array1OfInteger from TColStd;
254 ---Purpose: Returns 1 if the solution and the first argument are the same (2 circles).
255 -- if R1 is the radius of the first argument and Rsol the radius
256 -- of the solution and dist the distance between the two centers,
257 -- we concider the two circles are identical if R1+dist-Rsol is less than Tolerance.
258 -- 0 in the other cases.
260 TheSame2 : Array1OfInteger from TColStd;
261 ---Purpose: 1 if the solution and the second argument are the same (2 circles).
262 -- if R2 is the radius of the second argument and Rsol the radius
263 -- of the solution and dist the distance between the two centers,
264 -- we concider the two circles are identical if R2+dist-Rsol is less than Tolerance.
265 -- 0 in the other cases.
267 pnttg1sol : Array1OfPnt2d from TColgp;
268 ---Purpose: The tangency point between the solution and the first argument on the solution.
270 pnttg2sol : Array1OfPnt2d from TColgp;
271 ---Purpose: The tangency point between the solution and the second argument on the solution.
273 par1sol : Array1OfReal from TColStd;
274 ---Purpose: The parameter of the tangency point between the solution and the first argument on the solution.
276 par2sol : Array1OfReal from TColStd;
277 ---Purpose: The parameter of the tangency point between the solution and the second argument on the solution.
279 pararg1 : Array1OfReal from TColStd;
280 ---Purpose: The parameter of the tangency point between the solution and the first argument on the first argument.
282 pararg2 : Array1OfReal from TColStd;
283 ---Purpose: The parameter of the tangency point between the solution and the second argument on the second argument.
285 Invert : Boolean from Standard;
287 -- CircAna : Circ2d2TanRad from GccAna;
288 -- CircGeo : MyrCirc2d2TanRad from Geom2dGcc;
289 -- TypeAna : Boolean;