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