| 1 | -- File: Circ2dTanOnRad.cdl |
| 2 | -- Created: Fri Mar 22 11:45:45 1991 |
| 3 | -- Author: Philippe DAUTRY |
| 4 | -- <fid@phobox> |
| 5 | ---Copyright: Matra Datavision 1991 |
| 6 | |
| 7 | class Circ2dTanOnRad |
| 8 | |
| 9 | from GccAna |
| 10 | |
| 11 | ---Purpose: This class implements the algorithms used to |
| 12 | -- create a 2d circle tangent to a 2d entity, |
| 13 | -- centered on a curv and with a given radius. |
| 14 | -- The arguments of all construction methods are : |
| 15 | -- - The qualified element for the tangency constrains |
| 16 | -- (QualifiedCirc, QualifiedLin, Points). |
| 17 | -- - The Center element (circle, line). |
| 18 | -- - A real Tolerance. |
| 19 | -- Tolerance is only used in the limits cases. |
| 20 | -- For example : |
| 21 | -- We want to create a circle tangent to an OutsideCirc C1 |
| 22 | -- centered on a line OnLine with a radius Radius and with |
| 23 | -- a tolerance Tolerance. |
| 24 | -- If we did not use Tolerance it is impossible to |
| 25 | -- find a solution in the the following case : OnLine is |
| 26 | -- outside C1. There is no intersection point between C1 |
| 27 | -- and OnLine. The distance between the line and the |
| 28 | -- circle is greater than Radius. |
| 29 | -- With Tolerance we will give a solution if the |
| 30 | -- distance between C1 and OnLine is lower than or |
| 31 | -- equal Tolerance. |
| 32 | |
| 33 | --inherits Storable from Standard |
| 34 | |
| 35 | uses Pnt2d from gp, |
| 36 | Lin2d from gp, |
| 37 | Circ2d from gp, |
| 38 | QualifiedCirc from GccEnt, |
| 39 | QualifiedLin from GccEnt, |
| 40 | Array1OfReal from TColStd, |
| 41 | Array1OfInteger from TColStd, |
| 42 | Array1OfCirc2d from TColgp, |
| 43 | Array1OfPnt2d from TColgp, |
| 44 | Position from GccEnt, |
| 45 | Array1OfPosition from GccEnt |
| 46 | |
| 47 | raises NegativeValue from Standard, |
| 48 | OutOfRange from Standard, |
| 49 | NotDone from StdFail, |
| 50 | BadQualifier from GccEnt |
| 51 | |
| 52 | is |
| 53 | |
| 54 | ---Category: On a line ................................................ |
| 55 | |
| 56 | Create(Qualified1 : QualifiedCirc from GccEnt ; |
| 57 | OnLine : Lin2d from gp ; |
| 58 | Radius : Real from Standard; |
| 59 | Tolerance : Real from Standard) returns Circ2dTanOnRad |
| 60 | ---Purpose: This methods implements the algorithms used to create |
| 61 | -- 2d Circles tangent to a circle and centered on a 2d Line |
| 62 | -- with a given radius. |
| 63 | -- Tolerance is used to find solution in every limit cases. |
| 64 | -- For example Tolerance is used in the case of EnclosedCirc when |
| 65 | -- Radius-R1+dist is greater Tolerance (dist is the distance |
| 66 | -- between the line and the location of the circ, R1 is the |
| 67 | -- radius of the circ) because there is no solution. |
| 68 | raises NegativeValue, BadQualifier; |
| 69 | ---Purpose: raises NegativeValue in case of NegativeRadius. |
| 70 | |
| 71 | Create(Qualified1 : QualifiedLin from GccEnt ; |
| 72 | OnLine : Lin2d from gp ; |
| 73 | Radius : Real from Standard; |
| 74 | Tolerance : Real from Standard) returns Circ2dTanOnRad |
| 75 | ---Purpose: This methods implements the algorithms used to create |
| 76 | -- 2d Circles tangent to a 2d Line and centered on a 2d Line |
| 77 | -- with a given radius. |
| 78 | -- Tolerance is used to find solution in every limit cases. |
| 79 | raises NegativeValue, BadQualifier; |
| 80 | ---Purpose: raises NegativeValue in case of NegativeRadius. |
| 81 | |
| 82 | Create(Point1 : Pnt2d from gp ; |
| 83 | OnLine : Lin2d from gp ; |
| 84 | Radius : Real from Standard; |
| 85 | Tolerance : Real from Standard) returns Circ2dTanOnRad |
| 86 | ---Purpose: This methods implements the algorithms used to create |
| 87 | -- 2d Circles passing through a 2d Point and centered on a |
| 88 | -- 2d Line with a given radius. |
| 89 | -- Tolerance is used to find solution in every limit cases. |
| 90 | raises NegativeValue; |
| 91 | -- raises NegativeValue in case of NegativeRadius. |
| 92 | |
| 93 | ---Category: On a circle ................................................ |
| 94 | |
| 95 | Create(Qualified1 : QualifiedCirc from GccEnt ; |
| 96 | OnCirc : Circ2d from gp ; |
| 97 | Radius : Real from Standard; |
| 98 | Tolerance : Real from Standard) returns Circ2dTanOnRad |
| 99 | ---Purpose: This methods implements the algorithms used to create |
| 100 | -- 2d Circles tangent to a circle and centered on a 2d Circle |
| 101 | -- with a given radius. |
| 102 | -- Tolerance is used to find solution in every limit cases. |
| 103 | raises NegativeValue, BadQualifier; |
| 104 | ---Purpose: raises NegativeValue in case of NegativeRadius. |
| 105 | |
| 106 | Create(Qualified1 : QualifiedLin from GccEnt ; |
| 107 | OnCirc : Circ2d from gp ; |
| 108 | Radius : Real from Standard; |
| 109 | Tolerance : Real from Standard) returns Circ2dTanOnRad |
| 110 | ---Purpose: This methods implements the algorithms used to create |
| 111 | -- 2d Circles tangent to a 2d Line and centered on a 2d Line |
| 112 | -- with a given radius. |
| 113 | -- Tolerance is used to find solution in every limit cases. |
| 114 | raises NegativeValue, BadQualifier; |
| 115 | ---Purpose: raises NegativeValue in case of NegativeRadius. |
| 116 | |
| 117 | Create(Point1 : Pnt2d from gp ; |
| 118 | OnCirc : Circ2d from gp ; |
| 119 | Radius : Real from Standard; |
| 120 | Tolerance : Real from Standard) returns Circ2dTanOnRad |
| 121 | ---Purpose: This methods implements the algorithms used to create |
| 122 | -- 2d Circles passing through a 2d Point and centered on a |
| 123 | -- 2d Line with a given radius. |
| 124 | -- Tolerance is used to find solution in every limit cases. |
| 125 | raises NegativeValue; |
| 126 | ---Purpose: raises NegativeValue in case of NegativeRadius. |
| 127 | |
| 128 | -- -- .................................................................... |
| 129 | |
| 130 | IsDone(me) returns Boolean from Standard |
| 131 | is static; |
| 132 | ---Purpose: Returns true if the construction algorithm does not fail |
| 133 | -- (even if it finds no solution). |
| 134 | -- Note: IsDone protects against a failure arising from a |
| 135 | -- more internal intersection algorithm, which has |
| 136 | -- reached its numeric limits. |
| 137 | |
| 138 | NbSolutions(me) returns Integer from Standard |
| 139 | ---Purpose: This method returns the number of circles, representing solutions. |
| 140 | -- Raises NotDone if the construction algorithm didn't succeed. |
| 141 | raises NotDone |
| 142 | is static; |
| 143 | |
| 144 | ThisSolution(me ; |
| 145 | Index : Integer from Standard) returns Circ2d from gp |
| 146 | ---Purpose: Returns the solution number Index and raises OutOfRange |
| 147 | -- exception if Index is greater than the number of solutions. |
| 148 | -- Be careful: the Index is only a way to get all the |
| 149 | -- solutions, but is not associated to theses outside the |
| 150 | -- context of the algorithm-object. |
| 151 | -- Raises NotDone if the construction algorithm didn't succeed. |
| 152 | -- It raises OutOfRange if Index is greater than the |
| 153 | -- number of solutions |
| 154 | raises OutOfRange, NotDone |
| 155 | is static; |
| 156 | |
| 157 | |
| 158 | WhichQualifier(me ; |
| 159 | Index : Integer from Standard; |
| 160 | Qualif1 : out Position from GccEnt ) |
| 161 | raises OutOfRange, NotDone |
| 162 | is static; |
| 163 | ---Purpose: Returns the qualifier Qualif1 of the tangency argument |
| 164 | -- for the solution of index Index computed by this algorithm. |
| 165 | -- The returned qualifier is: |
| 166 | -- - that specified at the start of construction when the |
| 167 | -- solutions are defined as enclosed, enclosing or |
| 168 | -- outside with respect to the argument, or |
| 169 | -- - that computed during construction (i.e. enclosed, |
| 170 | -- enclosing or outside) when the solutions are defined |
| 171 | -- as unqualified with respect to the argument, or |
| 172 | -- - GccEnt_noqualifier if the tangency argument is a point. |
| 173 | -- Exceptions |
| 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. |
| 177 | |
| 178 | Tangency1(me ; |
| 179 | Index : Integer from Standard; |
| 180 | ParSol,ParArg : out Real from Standard; |
| 181 | PntSol : out Pnt2d from gp ) |
| 182 | ---Purpose: Returns informations about the tangency point between the |
| 183 | -- result number Index and the first argument. |
| 184 | -- ParSol is the intrinsic parameter of the point on the |
| 185 | -- solution curv. |
| 186 | -- ParArg is the intrinsic parameter of the point on the |
| 187 | -- argument curv. |
| 188 | -- PntSol is the tangency point on the solution curv. |
| 189 | -- PntArg is the tangency point on the argument curv. |
| 190 | -- Raises NotDone if the construction algorithm didn't succeed. |
| 191 | -- It raises OutOfRange if Index is greater than the |
| 192 | -- number of solutions. |
| 193 | raises OutOfRange, NotDone |
| 194 | is static; |
| 195 | |
| 196 | CenterOn3 (me ; |
| 197 | Index : Integer from Standard; |
| 198 | ParArg : out Real from Standard; |
| 199 | PntSol : out Pnt2d from gp ) |
| 200 | ---Purpose: Returns informations about the center (on the curv) |
| 201 | -- of the result. |
| 202 | -- ParArg is the intrinsic parameter of the point on |
| 203 | -- the argument curv. |
| 204 | -- PntSol is the center point of the solution curv. |
| 205 | -- Raises NotDone if the construction algorithm didn't succeed. |
| 206 | -- It raises OutOfRange if Index is greater than the |
| 207 | -- number of solutions. |
| 208 | raises OutOfRange, NotDone |
| 209 | is static; |
| 210 | |
| 211 | |
| 212 | IsTheSame1(me ; |
| 213 | Index : Integer from Standard) returns Boolean from Standard |
| 214 | ---Purpose: Returns True if the solution number Index is equal to |
| 215 | -- the first argument and False in the other cases. |
| 216 | -- Raises NotDone if the construction algorithm didn't succeed. |
| 217 | -- It raises OutOfRange if Index is greater than the |
| 218 | -- number of solutions. |
| 219 | raises OutOfRange, NotDone |
| 220 | is static; |
| 221 | |
| 222 | |
| 223 | fields |
| 224 | |
| 225 | WellDone : Boolean from Standard; |
| 226 | ---Purpose: True if the algorithm succeeded. |
| 227 | |
| 228 | NbrSol : Integer from Standard; |
| 229 | ---Purpose: The number of possible solutions. We have to decide about the |
| 230 | -- status of the multiple solutions... |
| 231 | |
| 232 | cirsol : Array1OfCirc2d from TColgp; |
| 233 | ---Purpose : The solutions. |
| 234 | |
| 235 | qualifier1 : Array1OfPosition from GccEnt; |
| 236 | -- The qualifiers of the first argument. |
| 237 | |
| 238 | TheSame1 : Array1OfInteger from TColStd; |
| 239 | ---Purpose: 1 if the solution and the first argument are the same in the |
| 240 | -- tolerance of Tolerance. |
| 241 | -- 0 in the other cases. |
| 242 | |
| 243 | pnttg1sol : Array1OfPnt2d from TColgp; |
| 244 | ---Purpose: The tangency point between the solution and the first |
| 245 | -- argument on the solution. |
| 246 | |
| 247 | pntcen3 : Array1OfPnt2d from TColgp; |
| 248 | ---Purpose: The center point of the solution on the first argument. |
| 249 | |
| 250 | par1sol : Array1OfReal from TColStd; |
| 251 | ---Purpose: The parameter of the tangency point between the solution |
| 252 | -- and the first argument on thesolution. |
| 253 | |
| 254 | pararg1 : Array1OfReal from TColStd; |
| 255 | ---Purpose: The parameter of the tangency point between the solution |
| 256 | -- and the first argument on the first argument. |
| 257 | |
| 258 | parcen3 : Array1OfReal from TColStd; |
| 259 | ---Purpose: The parameter of the center point of the solution on the |
| 260 | -- second argument. |
| 261 | |
| 262 | end Circ2dTanOnRad; |
| 263 | |