7fd59977 |
1 | -- File: Lin2d2Tan.cdl |
2 | -- Created: Wed Apr 3 11:15:13 1991 |
3 | -- Author: Remi GILET |
4 | -- <reg@topsn2> |
5 | ---Copyright: Matra Datavision 1991 |
6 | |
7 | |
8 | class Lin2d2Tan |
9 | |
10 | from GccAna |
11 | |
12 | ---Purpose: This class implements the algorithms used to |
13 | -- create 2d lines tangent to 2 other elements which |
14 | -- can be circles or points. |
15 | -- Describes functions for building a 2D line: |
16 | -- - tangential to 2 circles, or |
17 | -- - tangential to a circle and passing through a point, or |
18 | -- - passing through 2 points. |
19 | -- A Lin2d2Tan object provides a framework for: |
20 | -- - defining the construction of 2D line(s), |
21 | -- - implementing the construction algorithm, and |
22 | -- consulting the result(s). |
23 | -- Some constructors may check the type of the qualified argument |
24 | -- and raise BadQualifier Error in case of incorrect couple (qualifier, |
25 | -- curv). |
26 | -- For example: "EnclosedCirc". |
27 | |
28 | uses Pnt2d from gp, |
29 | Lin2d from gp, |
30 | QualifiedCirc from GccEnt, |
31 | Array1OfLin2d from TColgp, |
32 | Array1OfPnt2d from TColgp, |
33 | Array1OfReal from TColStd, |
34 | Position from GccEnt, |
35 | Array1OfPosition from GccEnt |
36 | |
37 | |
38 | raises OutOfRange from Standard, |
39 | BadQualifier from GccEnt, |
40 | NotDone from StdFail |
41 | |
42 | is |
43 | |
44 | |
45 | |
46 | Create (ThePoint1 : Pnt2d from gp ; |
47 | ThePoint2 : Pnt2d from gp ; |
48 | Tolerance : Real from Standard) returns Lin2d2Tan; |
49 | ---Purpose: This methods implements the algorithms used to |
50 | -- create 2d lines passing thrue 2 points. |
51 | -- Tolerance is used because we can't create a line |
52 | -- when the distance between the two points is too small. |
53 | |
54 | Create (Qualified1 : QualifiedCirc from GccEnt ; |
55 | ThePoint : Pnt2d from gp ; |
56 | Tolerance : Real from Standard) returns Lin2d2Tan |
57 | raises BadQualifier; |
58 | ---Purpose: This methods implements the algorithms used to |
59 | -- create 2d lines tangent to one circle and passing |
60 | -- thrue a point. |
61 | -- Exception BadQualifier is raised in the case of |
62 | -- EnclosedCirc |
63 | -- Tolerance is used because there is no solution |
64 | -- when the point is inside the solution according to |
65 | -- the tolerance. |
66 | |
67 | Create (Qualified1 : QualifiedCirc from GccEnt ; |
68 | Qualified2 : QualifiedCirc from GccEnt ; |
69 | Tolerance : Real from Standard) returns Lin2d2Tan |
70 | raises BadQualifier; |
71 | ---Purpose: This methods implements the algorithms used to |
72 | -- create 2d lines tangent to 2 circles. |
73 | -- Exception BadQualifier is raised in the case of |
74 | -- EnclosedCirc |
75 | |
76 | -------------------------------------------------------------------------- |
77 | |
78 | IsDone (me) returns Boolean from Standard |
79 | is static; |
80 | ---Purpose: This method returns true when there is a solution |
81 | -- and false in the other cases. |
82 | |
83 | NbSolutions(me) returns Integer from Standard |
84 | ---Purpose: This method returns the number of solutions. |
85 | -- Raises NotDone if the construction algorithm didn't succeed. |
86 | raises NotDone |
87 | is static; |
88 | |
89 | |
90 | ThisSolution(me ; |
91 | Index : Integer from Standard) returns Lin2d |
92 | ---Purpose : Returns the solution number Index and raises OutOfRange |
93 | -- exception if Index is greater than the number of solutions. |
94 | -- Be carefull: the Index is only a way to get all the |
95 | -- solutions, but is not associated to theses outside the |
96 | -- context of the algorithm-object. Raises OutOfRange is raised if Index is greater than |
97 | -- the number of solutions. |
98 | -- It raises NotDone if the algorithm failed. |
99 | raises OutOfRange, NotDone |
100 | is static; |
101 | |
102 | |
103 | WhichQualifier(me ; |
104 | Index : Integer from Standard; |
105 | Qualif1 : out Position from GccEnt ; |
106 | Qualif2 : out Position from GccEnt ) |
107 | raises OutOfRange, NotDone |
108 | is static; |
109 | ---Purpose: Returns the qualifiers Qualif1 and Qualif2 of the |
110 | -- tangency arguments for the solution of index Index |
111 | -- computed by this algorithm. |
112 | -- The returned qualifiers are: |
113 | -- - those specified at the start of construction when the |
114 | -- solutions are defined as enclosing or outside with |
115 | -- respect to the arguments, or |
116 | -- - those computed during construction (i.e. enclosing or |
117 | -- outside) when the solutions are defined as unqualified |
118 | -- with respect to the arguments, or |
119 | -- - GccEnt_noqualifier if the tangency argument is a point. |
120 | -- Exceptions |
121 | -- Standard_OutOfRange if Index is less than zero or |
122 | -- greater than the number of solutions computed by this algorithm. |
123 | -- StdFail_NotDone if the construction fails. |
124 | |
125 | |
126 | Tangency1(me ; |
127 | Index : Integer from Standard; |
128 | ParSol,ParArg : out Real from Standard; |
129 | PntSol : out Pnt2d from gp ) |
130 | ---Purpose : Returns informations about the tangency point between the |
131 | -- result number Index and the first argument. |
132 | -- ParSol is the intrinsic parameter of the point PntSol on |
133 | -- the solution curv. |
134 | -- ParArg is the intrinsic parameter of the point PntSol on |
135 | -- the argument curv. Raises OutOfRange is raised if Index is greater than |
136 | -- the number of solutions. |
137 | -- It raises NotDone if the algorithm failed. |
138 | raises OutOfRange, NotDone |
139 | is static; |
140 | |
141 | Tangency2(me ; |
142 | Index : Integer from Standard; |
143 | ParSol,ParArg : out Real from Standard; |
144 | PntSol : out Pnt2d from gp ) |
145 | ---Purpose : Returns informations about the tangency point between the |
146 | -- result number Index and the second argument. |
147 | -- ParSol is the intrinsic parameter of the point ParSol on |
148 | -- the solution curv. |
149 | -- ParArg is the intrinsic parameter of the point PntSol on |
150 | -- the argument curv. Raises OutOfRange is raised if Index is greater than |
151 | -- the number of solutions. |
152 | -- It raises NotDone if the algorithm failed. |
153 | raises OutOfRange, NotDone |
154 | is static; |
155 | |
156 | |
157 | fields |
158 | |
159 | WellDone : Boolean from Standard; |
160 | ---Purpose : True if the algorithm succeeded. |
161 | |
162 | NbrSol : Integer from Standard; |
163 | ---Purpose : The number of possible solutions. We have to decide about the |
164 | -- status of the multiple solutions... |
165 | |
166 | linsol : Array1OfLin2d from TColgp; |
167 | ---Purpose : Thesolutions. |
168 | |
169 | qualifier1 : Array1OfPosition from GccEnt; |
170 | ---Purpose: The qualifiers of the first argument. |
171 | |
172 | qualifier2 : Array1OfPosition from GccEnt; |
173 | ---Purpose: The qualifiers of the second argument. |
174 | |
175 | pnttg1sol : Array1OfPnt2d from TColgp; |
176 | ---Purpose: The tangency point between the solution and the first |
177 | -- argument on the solution. |
178 | |
179 | pnttg2sol : Array1OfPnt2d from TColgp; |
180 | ---Purpose: The tangency point between the solution and the second |
181 | -- argument on the solution. |
182 | |
183 | par1sol : Array1OfReal from TColStd; |
184 | ---Purpose: The parameter of the tangency point between the solution |
185 | -- and the first argument on the solution. |
186 | |
187 | par2sol : Array1OfReal from TColStd; |
188 | ---Purpose: The parameter of the tangency point between the solution |
189 | -- and the second argument on the solution. |
190 | |
191 | pararg1 : Array1OfReal from TColStd; |
192 | ---Purpose: The parameter of the tangency point between the solution |
193 | -- and the first argument on the first argument. |
194 | |
195 | pararg2 : Array1OfReal from TColStd; |
196 | ---Purpose: The parameter of the tangency point between the solution |
197 | -- and the second argument on the second argument. |
198 | |
199 | end Lin2d2Tan; |