CommitLineData
2-- Created: Tue Oct 20 16:24:03 1992
3-- Author: Remi GILET
4-- <reg@sdsun1>
6
8
9 ---Purpose: This class implements the algorithms used to
10 -- create a 2d circle tangent to a 2d entity,
11 -- centered on a 2d entity and with a given radius.
12 -- More than one argument must be a curve.
13 -- The arguments of all construction methods are :
14 -- - The qualified element for the tangency constrains
15 -- (QualifiedCirc, QualifiedLin, QualifiedCurvPoints).
16 -- - The Center element (circle, line, curve).
17 -- - A real Tolerance.
18 -- Tolerance is only used in the limits cases.
19 -- For example :
20 -- We want to create a circle tangent to an OutsideCurv Cu1
21 -- centered on a line OnLine with a radius Radius and with
22 -- a tolerance Tolerance.
23 -- If we did not used Tolerance it is impossible to
24 -- find a solution in the the following case : OnLine is
25 -- outside Cu1. There is no intersection point between Cu1
26 -- and OnLine. The distance between the line and the
27 -- circle is greater than Radius.
28 -- With Tolerance we will give a solution if the
29 -- distance between Cu1 and OnLine is lower than or
30 -- equal Tolerance.
31
32-- inherits Entity from Standard
33
34uses Lin2d from gp,
35 Circ2d from gp,
36 Pnt2d from gp,
37 Point from Geom2d,
38 Array1OfCirc2d from TColgp,
39 Array1OfPnt2d from TColgp,
41 QualifiedCurve from Geom2dGcc,
42 Array1OfReal from TColStd,
43 Array1OfInteger from TColStd,
46 Position from GccEnt,
47 Array1OfPosition from GccEnt
48
49raises NegativeValue from Standard,
50 OutOfRange from Standard,
52 NotDone from StdFail
53
54is
55
56Create(Qualified1 : QualifiedCurve from Geom2dGcc ;
57 OnCurv : Curve from Geom2dAdaptor;
58 Radius : Real from Standard ;
59 Tolerance : Real from Standard )
63 -- centered on the 2D curve OnCurv and:
64 -- - tangential to the curve Qualified1
65
66Create(Point1 : Point from Geom2d ;
67 OnCurv : Curve from Geom2dAdaptor;
68 Radius : Real from Standard ;
69 Tolerance : Real from Standard )
71raises NegativeValue;
73 -- centered on the 2D curve OnCurv and:
74 -- passing through the point Point1.
75 -- OnCurv is an adapted curve, i.e. an object which is an
76 -- interface between:
77 -- - the services provided by a 2D curve from the package Geom2d,
78 -- - and those required on the curve by the construction algorithm.
79 -- Similarly, the qualified curve Qualified1 is created from
81 -- Adapted curves are created in the following way:
82 -- Handle(Geom2d_Curve) myCurveOn = ... ;
83 -- Geom2dAdaptor_Curve OnCurv ( myCurveOn ) ;
84 -- The algorithm is then constructed with this object:
85 -- Handle(Geom2d_Curve) myCurve1 = ...
86 -- ;
88 -- Geom2dGcc_QualifiedCurve
90 -- Standard_Real Radius = ... , Tolerance = ... ;
92 -- myAlgo ( Qualified1 , OnCurv , Radius , Tolerance ) ;
93 -- if ( myAlgo.IsDone() )
94 -- { Standard_Integer Nbr = myAlgo.NbSolutions() ;
95 -- gp_Circ2d Circ ;
96 -- for ( Standard_Integer i = 1 ;
97 -- i <= nbr ; i++ )
98 -- { Circ = myAlgo.ThisSolution (i) ;
99 -- ...
100 -- }
101 -- }
102
103Results(me : in out ;
104 Circ : Circ2dTanOnRad from GccAna)
105is static;
106
107Results(me : in out ;
108 Circ : MyCirc2dTanOnRad from Geom2dGcc)
109is static;
110
111IsDone(me) returns Boolean from Standard
112is static;
113 ---Purpose: Returns true if the construction algorithm does not fail
114 -- (even if it finds no solution).
115 -- Note: IsDone protects against a failure arising from a
116 -- more internal intersection algorithm which has reached
117 -- its numeric limits.
118NbSolutions(me) returns Integer from Standard
119raises NotDone
120is static;
121 ---Purpose: Returns the number of circles, representing solutions
122 -- computed by this algorithm.
123 -- Exceptions: StdFail_NotDone if the construction fails.
124
125ThisSolution(me ; Index : Integer from Standard) returns Circ2d from gp
126raises OutOfRange, NotDone
127is static;
128 ---Purpose: Returns the solution number Index and raises OutOfRange
129 -- exception if Index is greater than the number of solutions.
130 -- Be carefull: the Index is only a way to get all the
131 -- solutions, but is not associated to theses outside the context
132 -- of the algorithm-object.
133 -- Exceptions
134 -- Standard_OutOfRange if Index is less than zero or
135 -- greater than the number of solutions computed by this algorithm.
136 -- StdFail_NotDone if the construction fails.
137
138WhichQualifier(me ;
139 Index : Integer from Standard;
140 Qualif1 : out Position from GccEnt )
141raises OutOfRange, NotDone
142is static;
143 --- Purpose: Returns the qualifier Qualif1 of the tangency argument
144 -- for the solution of index Index computed by this algorithm.
145 -- The returned qualifier is:
146 -- - that specified at the start of construction when the
147 -- solutions are defined as enclosed, enclosing or
148 -- outside with respect to the arguments, or
149 -- - that computed during construction (i.e. enclosed,
150 -- enclosing or outside) when the solutions are defined
151 -- as unqualified with respect to the arguments, or
152 -- - GccEnt_noqualifier if the tangency argument is a point.
153 -- Exceptions
154 -- Standard_OutOfRange if Index is less than zero or
155 -- greater than the number of solutions computed by this algorithm.
156 -- StdFail_NotDone if the construction fails.
157
158Tangency1(me ;
159 Index : Integer from Standard;
160 ParSol,ParArg : out Real from Standard;
161 PntSol : out Pnt2d from gp )
162raises OutOfRange, NotDone
163is static;
164 ---Purpose: Returns informations about the tangency point between the
165 -- result number Index and the first argument.
166 -- ParSol is the intrinsic parameter of the point on the solution curv.
167 -- ParArg is the intrinsic parameter of the point on the argument curv.
168 -- PntSol is the tangency point on the solution curv.
169 -- PntArg is the tangency point on the argument curv.
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
175CenterOn3 (me ;
176 Index : Integer from Standard;
177 ParArg : out Real from Standard;
178 PntSol : out Pnt2d from gp )
179raises OutOfRange, NotDone
180is static;
181 ---Purpose: Returns the center PntSol on the second argument (i.e.
182 -- line or circle) of the solution of index Index computed by
183 -- this algorithm.
184 -- ParArg is the intrinsic parameter of the point on the argument curv.
185 -- PntSol is the center point of the solution curv.
186 -- PntArg is the projection of PntSol on the argument curv.
187 -- Exceptions:
188 -- Standard_OutOfRange if Index is less than zero or
189 -- greater than the number of solutions computed by this algorithm.
190 -- StdFail_NotDone if the construction fails.
191
192IsTheSame1(me ;
193 Index : Integer from Standard) returns Boolean from Standard
194raises OutOfRange, NotDone
195is static;
196 ---Purpose: Returns true if the solution of index Index and the first
197 -- argument of this algorithm are the same (i.e. there are 2
198 -- identical circles).
199 -- If Rarg is the radius of the first argument, Rsol is the
200 -- radius of the solution and dist is the distance between
201 -- the two centers, we consider the two circles to be
202 -- identical if |Rarg - Rsol| and dist are less than
203 -- or equal to the tolerance criterion given at the time of
204 -- construction of this algorithm.
205 -- OutOfRange is raised if Index is greater than the number of solutions.
206 -- notDone is raised if the construction algorithm did not succeed.
207
208fields
209
210 WellDone : Boolean from Standard;
211 -- True if the algorithm succeeded.
212
213 NbrSol : Integer from Standard;
214 -- The number of possible solutions. We have to decide about the
215 -- status of the multiple solutions...
216
217 cirsol : Array1OfCirc2d from TColgp;
218 ---Purpose : The solutions.
219
220 qualifier1 : Array1OfPosition from GccEnt;
221 -- The qualifiers of the first argument.
222
223 TheSame1 : Array1OfInteger from TColStd;
224
225 pnttg1sol : Array1OfPnt2d from TColgp;
226 -- The tangency point between the solution and the first argument on
227 -- the solution.
228
229 par1sol : Array1OfReal from TColStd;
230 -- The parameter of the tangency point between the solution and the
231 -- first argument on the solution.
232
233 pararg1 : Array1OfReal from TColStd;
234 -- The parameter of the tangency point between the solution and the first
235 -- argument on the first argument.
236
237 pntcen3 : Array1OfPnt2d from TColgp;
238 -- The center point of the solution on the first argument.
239
240 parcen3 : Array1OfReal from TColStd;
241 -- The parameter of the center point of the solution on the second
242 -- argument.
243