7fd59977 |
1 | -- File: Circ2d2TanRad.cdl |
2 | -- Created: Fri Mar 29 10:23:56 1991 |
3 | -- Author: Remi GILET |
4 | -- <reg@topsn2> |
5 | ---Copyright: Matra Datavision 1991 |
6 | |
7 | generic class Circ2d2TanRad from GccGeo ( |
8 | TheCurve as any; |
9 | TheTool as any; |
10 | TheQCurve as any; -- as QualifiedCurve from GccEnt |
11 | -- (TheCurve) |
12 | TheParGenCurve as any; -- as ParGenCurve from GccGeo |
13 | -- (TheCurve) |
14 | TheHParGenCurve as Transient; |
15 | TheCurvePGTool as any; -- as CurvePGTool from GccGeo |
16 | -- (Thecurve, |
17 | -- TheTool, |
18 | -- TheParGenCurve) |
19 | TheIntConicCurve as any; -- as IntConicCurveOfGOffsetInter |
20 | TheIntCurveCurve as any) -- as GOffsetInter from Geom2dInt |
21 | -- (TheParGenCurve, |
22 | -- TheCurvePGTool) |
23 | |
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. |
34 | -- For example : |
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 following case : Cu2 is |
40 | -- inside C1 and there is no intersection point |
41 | -- between the two elements. |
42 | -- With Tolerance we will get a solution if the |
43 | -- lowest distance between C1 and Cu2 is lower than or |
44 | -- equal Tolerance. |
45 | |
46 | -- inherits Entity from Standard |
47 | |
48 | uses Pnt2d from gp, |
49 | Circ2d from gp, |
50 | Array1OfCirc2d from TColgp, |
51 | Array1OfPnt2d from TColgp, |
52 | QualifiedCirc from GccEnt, |
53 | QualifiedLin from GccEnt, |
54 | Array1OfReal from TColStd, |
55 | Array1OfInteger from TColStd, |
56 | Position from GccEnt, |
57 | Array1OfPosition from GccEnt |
58 | |
59 | raises OutOfRange from Standard, |
60 | BadQualifier from GccEnt, |
61 | NotDone from StdFail, |
62 | NegativeValue from Standard |
63 | |
64 | is |
65 | |
66 | Create(Qualified1 : QualifiedCirc from GccEnt ; |
67 | Qualified2 : TheQCurve ; |
68 | Radius : Real from Standard; |
69 | Tolerance : Real from Standard) returns Circ2d2TanRad |
70 | ---Purpose: This method implements the algorithms used to |
71 | -- create 2d circles TANgent to a 2d circle and a curve |
72 | -- with a radius of Radius. |
73 | raises NegativeValue, BadQualifier; |
74 | ---Purpose: It raises NegativeValue if Radius is lower than zero. |
75 | |
76 | Create(Qualified1 : QualifiedLin from GccEnt ; |
77 | Qualified2 : TheQCurve ; |
78 | Radius : Real from Standard; |
79 | Tolerance : Real from Standard) returns Circ2d2TanRad |
80 | ---Purpose: This method implements the algorithms used to |
81 | -- create 2d circles TANgent to a 2d line and a curve |
82 | -- with a radius of Radius. |
83 | raises NegativeValue, BadQualifier; |
84 | ---Purpose: It raises NegativeValue if Radius is lower than zero. |
85 | |
86 | Create(Qualified1 : TheQCurve ; |
87 | Qualified2 : TheQCurve ; |
88 | Radius : Real from Standard; |
89 | Tolerance : Real from Standard) returns Circ2d2TanRad |
90 | ---Purpose: This method implements the algorithms used to |
91 | -- create 2d circles TANgent to two curves with |
92 | -- a radius of Radius. |
93 | raises NegativeValue, BadQualifier; |
94 | ---Purpose: It raises NegativeValue if Radius is lower than zero. |
95 | |
96 | Create(Qualified1 : TheQCurve ; |
97 | Point2 : Pnt2d from gp ; |
98 | Radius : Real from Standard; |
99 | Tolerance : Real from Standard) returns Circ2d2TanRad |
100 | ---Purpose: This method implements the algorithms used to |
101 | -- create 2d circles TANgent to a curve and a point |
102 | -- with a radius of Radius. |
103 | raises NegativeValue, BadQualifier; |
104 | ---Purpose: It raises NegativeValue if Radius is lower than zero. |
105 | |
106 | -- -- .................................................................... |
107 | |
108 | IsDone(me) returns Boolean from Standard |
109 | is static; |
110 | ---Purpose: This method returns True if the algorithm succeeded. |
111 | |
112 | NbSolutions(me) returns Integer from Standard |
113 | ---Purpose: This method returns the number of solutions. |
114 | raises NotDone |
115 | is static; |
116 | ---Purpose: It raises NotDone if the algorithm failed. |
117 | |
118 | ThisSolution(me ; |
119 | Index : Integer from Standard) returns Circ2d from gp |
120 | ---Purpose: Returns the solution number Index. |
121 | -- Be careful: the Index is only a way to get all the |
122 | -- solutions, but is not associated to those outside the context |
123 | -- of the algorithm-object. |
124 | raises OutOfRange, NotDone |
125 | is static; |
126 | ---Purpose: It raises OutOfRange exception if Index is greater |
127 | -- than the number of solutions. |
128 | -- It raises NotDone if the construction algorithm did not |
129 | -- succeed. |
130 | |
131 | WhichQualifier(me ; |
132 | Index : Integer from Standard; |
133 | Qualif1 : out Position from GccEnt ; |
134 | Qualif2 : out Position from GccEnt ) |
135 | raises OutOfRange, NotDone |
136 | is static; |
137 | ---Purpose: It returns the information about the qualifiers of |
138 | -- the tangency arguments concerning the solution number Index. |
139 | -- It returns the real qualifiers (the qualifiers given to the |
140 | -- constructor method in case of enclosed, enclosing and outside |
141 | -- and the qualifiers computedin case of unqualified). |
142 | |
143 | Tangency1(me ; |
144 | Index : Integer from Standard; |
145 | ParSol,ParArg : out Real from Standard; |
146 | PntSol : out Pnt2d from gp ) |
147 | ---Purpose: Returns information about the tangency point between the |
148 | -- result number Index and the first argument. |
149 | -- ParSol is the intrinsic parameter of the point PntSol on the solution. |
150 | -- ParArg is the intrinsic parameter of the point PntSol on the first |
151 | -- argument. |
152 | raises OutOfRange, NotDone |
153 | is static; |
154 | ---Purpose: It raises OutOfRange if Index is greater than the number |
155 | -- of solutions. |
156 | -- It raises NotDone if the construction algorithm did not |
157 | -- succeed. |
158 | |
159 | Tangency2(me ; |
160 | Index : Integer from Standard; |
161 | ParSol,ParArg : out Real from Standard; |
162 | PntSol : out Pnt2d from gp ) |
163 | ---Purpose: Returns information about the tangency point between the |
164 | -- result number Index and the second argument. |
165 | -- ParSol is the intrinsic parameter of the point PntSol on |
166 | -- the solution. |
167 | -- ParArg is the intrinsic parameter of the point PntArg on |
168 | -- the second argument. |
169 | raises OutOfRange, NotDone |
170 | is static; |
171 | ---Purpose: It raises OutOfRange if Index is greater than the number |
172 | -- of solutions. |
173 | -- It raises NotDone if the construction algorithm did not |
174 | -- succeed. |
175 | |
176 | IsTheSame1(me ; |
177 | Index : Integer from Standard) returns Boolean from Standard |
178 | ---Purpose: Returns True if the solution number Index is equal to |
179 | -- the first argument. |
180 | raises OutOfRange, NotDone |
181 | is static; |
182 | ---Purpose: It raises OutOfRange if Index is greater than the number |
183 | -- of solutions. |
184 | -- It raises NotDone if the construction algorithm did not |
185 | -- succeed. |
186 | |
187 | IsTheSame2(me ; |
188 | Index : Integer from Standard) returns Boolean from Standard |
189 | ---Purpose: Returns True if the solution number Index is equal to |
190 | -- the second argument. |
191 | raises OutOfRange, NotDone |
192 | is static; |
193 | ---Purpose: It raises OutOfRange if Index is greater than the number |
194 | -- of solutions. |
195 | -- It raises NotDone if the construction algorithm did not |
196 | -- succeed. |
197 | |
198 | fields |
199 | |
200 | WellDone : Boolean from Standard; |
201 | ---Purpose: True if the algorithm succeeded. |
202 | |
203 | NbrSol : Integer from Standard; |
204 | ---Purpose: The number of possible solutions. We have to decide about |
205 | -- the status of the multiple solutions... |
206 | |
207 | cirsol : Array1OfCirc2d from TColgp; |
208 | -- The solutions. |
209 | |
210 | qualifier1 : Array1OfPosition from GccEnt; |
211 | -- The qualifiers of the first argument. |
212 | |
213 | qualifier2 : Array1OfPosition from GccEnt; |
214 | -- The qualifiers of the second argument. |
215 | |
216 | TheSame1 : Array1OfInteger from TColStd; |
217 | ---Purpose: 1 if the solution and the first argument are the same |
218 | -- (2 circles). |
219 | -- If R1 is the radius of the first argument and Rsol the radius |
220 | -- of the solution and dist the distance between the two centers, |
221 | -- we consider the two circles are identical if R1+dist-Rsol is |
222 | -- less than Tolerance. |
223 | -- 0 in the other cases. |
224 | |
225 | TheSame2 : Array1OfInteger from TColStd; |
226 | ---Purpose: 1 if the solution and the second argument are the same |
227 | -- (2 circles). |
228 | -- If R2 is the radius of the second argument and Rsol the radius |
229 | -- of the solution and dist the distance between the two centers, |
230 | -- we consider the two circles are identical if R2+dist-Rsol is |
231 | -- less than Tolerance. |
232 | -- 0 in the other cases. |
233 | |
234 | pnttg1sol : Array1OfPnt2d from TColgp; |
235 | ---Purpose: The tangency point between the solution and the first |
236 | -- argument on the solution. |
237 | |
238 | pnttg2sol : Array1OfPnt2d from TColgp; |
239 | ---Purpose: The tangency point between the solution and the second |
240 | -- argument on the solution. |
241 | |
242 | par1sol : Array1OfReal from TColStd; |
243 | ---Purpose: The parameter of the tangency point between the solution |
244 | -- and the first argument on the solution. |
245 | |
246 | par2sol : Array1OfReal from TColStd; |
247 | ---Purpose: The parameter of the tangency point between the solution |
248 | -- and the second argument on the solution. |
249 | |
250 | pararg1 : Array1OfReal from TColStd; |
251 | ---Purpose: The parameter of the tangency point between the solution |
252 | -- and the first argument on the first argument. |
253 | |
254 | pararg2 : Array1OfReal from TColStd; |
255 | ---Purpose: The parameter of the tangency point between the solution |
256 | -- and the second argument on the second argument. |
257 | |
258 | end Circ2d2TanRad; |