Commit | Line | Data |
---|---|---|

b311480e | 1 | -- Created on: 1992-10-20 |

2 | -- Created by: Remi GILET | |

3 | -- Copyright (c) 1992-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 | -- |

d5f74e42 | 8 | -- This library is free software; you can redistribute it and/or modify it under |

9 | -- the terms of the GNU Lesser General Public License version 2.1 as published | |

973c2be1 | 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 Circ2dTanOnRad from Geom2dGcc | |

18 | ||

19 | ---Purpose: This class implements the algorithms used to | |

20 | -- create a 2d circle tangent to a 2d entity, | |

21 | -- centered on a 2d entity and with a given radius. | |

22 | -- More than one argument must be a curve. | |

23 | -- The arguments of all construction methods are : | |

24 | -- - The qualified element for the tangency constrains | |

25 | -- (QualifiedCirc, QualifiedLin, QualifiedCurvPoints). | |

26 | -- - The Center element (circle, line, curve). | |

27 | -- - A real Tolerance. | |

28 | -- Tolerance is only used in the limits cases. | |

29 | -- For example : | |

30 | -- We want to create a circle tangent to an OutsideCurv Cu1 | |

31 | -- centered on a line OnLine with a radius Radius and with | |

32 | -- a tolerance Tolerance. | |

33 | -- If we did not used Tolerance it is impossible to | |

34 | -- find a solution in the the following case : OnLine is | |

35 | -- outside Cu1. There is no intersection point between Cu1 | |

36 | -- and OnLine. The distance between the line and the | |

37 | -- circle is greater than Radius. | |

38 | -- With Tolerance we will give a solution if the | |

39 | -- distance between Cu1 and OnLine is lower than or | |

40 | -- equal Tolerance. | |

41 | ||

42 | -- inherits Entity from Standard | |

43 | ||

578ce4be | 44 | uses Lin2d from gp, |

45 | Circ2d from gp, | |

46 | Pnt2d from gp, | |

47 | Point from Geom2d, | |

48 | Array1OfCirc2d from TColgp, | |

49 | Array1OfPnt2d from TColgp, | |

50 | Curve from Geom2dAdaptor, | |

51 | QualifiedCurve from Geom2dGcc, | |

52 | Array1OfReal from TColStd, | |

53 | Array1OfInteger from TColStd, | |

54 | Circ2dTanOnRad from GccAna, | |

55 | Circ2dTanOnRadGeo from Geom2dGcc, | |

56 | Position from GccEnt, | |

57 | Array1OfPosition from GccEnt | |

7fd59977 | 58 | |

59 | raises NegativeValue from Standard, | |

60 | OutOfRange from Standard, | |

61 | BadQualifier from GccEnt, | |

62 | NotDone from StdFail | |

63 | ||

64 | is | |

65 | ||

66 | Create(Qualified1 : QualifiedCurve from Geom2dGcc ; | |

67 | OnCurv : Curve from Geom2dAdaptor; | |

68 | Radius : Real from Standard ; | |

69 | Tolerance : Real from Standard ) | |

70 | returns Circ2dTanOnRad from Geom2dGcc | |

71 | raises NegativeValue,BadQualifier; | |

72 | ---Purpose: Constructs one or more 2D circles of radius Radius, | |

73 | -- centered on the 2D curve OnCurv and: | |

74 | -- - tangential to the curve Qualified1 | |

75 | ||

76 | Create(Point1 : Point from Geom2d ; | |

77 | OnCurv : Curve from Geom2dAdaptor; | |

78 | Radius : Real from Standard ; | |

79 | Tolerance : Real from Standard ) | |

80 | returns Circ2dTanOnRad from Geom2dGcc | |

81 | raises NegativeValue; | |

82 | ---Purpose: Constructs one or more 2D circles of radius Radius, | |

83 | -- centered on the 2D curve OnCurv and: | |

84 | -- passing through the point Point1. | |

85 | -- OnCurv is an adapted curve, i.e. an object which is an | |

86 | -- interface between: | |

87 | -- - the services provided by a 2D curve from the package Geom2d, | |

88 | -- - and those required on the curve by the construction algorithm. | |

89 | -- Similarly, the qualified curve Qualified1 is created from | |

90 | -- an adapted curve. | |

91 | -- Adapted curves are created in the following way: | |

92 | -- Handle(Geom2d_Curve) myCurveOn = ... ; | |

93 | -- Geom2dAdaptor_Curve OnCurv ( myCurveOn ) ; | |

94 | -- The algorithm is then constructed with this object: | |

95 | -- Handle(Geom2d_Curve) myCurve1 = ... | |

96 | -- ; | |

97 | -- Geom2dAdaptor_Curve Adapted1 ( myCurve1 ) ; | |

98 | -- Geom2dGcc_QualifiedCurve | |

99 | -- Qualified1 = Geom2dGcc::Outside(Adapted1); | |

100 | -- Standard_Real Radius = ... , Tolerance = ... ; | |

101 | -- Geom2dGcc_Circ2dTanOnRad | |

102 | -- myAlgo ( Qualified1 , OnCurv , Radius , Tolerance ) ; | |

103 | -- if ( myAlgo.IsDone() ) | |

104 | -- { Standard_Integer Nbr = myAlgo.NbSolutions() ; | |

105 | -- gp_Circ2d Circ ; | |

106 | -- for ( Standard_Integer i = 1 ; | |

107 | -- i <= nbr ; i++ ) | |

108 | -- { Circ = myAlgo.ThisSolution (i) ; | |

109 | -- ... | |

110 | -- } | |

111 | -- } | |

112 | ||

113 | Results(me : in out ; | |

114 | Circ : Circ2dTanOnRad from GccAna) | |

115 | is static; | |

116 | ||

117 | Results(me : in out ; | |

578ce4be | 118 | Circ : Circ2dTanOnRadGeo from Geom2dGcc) |

7fd59977 | 119 | is static; |

120 | ||

121 | IsDone(me) returns Boolean from Standard | |

122 | is static; | |

123 | ---Purpose: Returns true if the construction algorithm does not fail | |

124 | -- (even if it finds no solution). | |

125 | -- Note: IsDone protects against a failure arising from a | |

126 | -- more internal intersection algorithm which has reached | |

127 | -- its numeric limits. | |

128 | NbSolutions(me) returns Integer from Standard | |

129 | raises NotDone | |

130 | is static; | |

131 | ---Purpose: Returns the number of circles, representing solutions | |

132 | -- computed by this algorithm. | |

133 | -- Exceptions: StdFail_NotDone if the construction fails. | |

134 | ||

135 | ThisSolution(me ; Index : Integer from Standard) returns Circ2d from gp | |

136 | raises OutOfRange, NotDone | |

137 | is static; | |

138 | ---Purpose: Returns the solution number Index and raises OutOfRange | |

139 | -- exception if Index is greater than the number of solutions. | |

140 | -- Be carefull: the Index is only a way to get all the | |

141 | -- solutions, but is not associated to theses outside the context | |

142 | -- of the algorithm-object. | |

143 | -- Exceptions | |

144 | -- Standard_OutOfRange if Index is less than zero or | |

145 | -- greater than the number of solutions computed by this algorithm. | |

146 | -- StdFail_NotDone if the construction fails. | |

147 | ||

148 | WhichQualifier(me ; | |

149 | Index : Integer from Standard; | |

150 | Qualif1 : out Position from GccEnt ) | |

151 | raises OutOfRange, NotDone | |

152 | is static; | |

153 | --- Purpose: Returns the qualifier Qualif1 of the tangency argument | |

154 | -- for the solution of index Index computed by this algorithm. | |

155 | -- The returned qualifier is: | |

156 | -- - that specified at the start of construction when the | |

157 | -- solutions are defined as enclosed, enclosing or | |

158 | -- outside with respect to the arguments, or | |

159 | -- - that computed during construction (i.e. enclosed, | |

160 | -- enclosing or outside) when the solutions are defined | |

161 | -- as unqualified with respect to the arguments, or | |

162 | -- - GccEnt_noqualifier if the tangency argument is a point. | |

163 | -- Exceptions | |

164 | -- Standard_OutOfRange if Index is less than zero or | |

165 | -- greater than the number of solutions computed by this algorithm. | |

166 | -- StdFail_NotDone if the construction fails. | |

167 | ||

168 | Tangency1(me ; | |

169 | Index : Integer from Standard; | |

170 | ParSol,ParArg : out Real from Standard; | |

171 | PntSol : out Pnt2d from gp ) | |

172 | raises OutOfRange, NotDone | |

173 | is static; | |

174 | ---Purpose: Returns informations about the tangency point between the | |

175 | -- result number Index and the first argument. | |

176 | -- ParSol is the intrinsic parameter of the point on the solution curv. | |

177 | -- ParArg is the intrinsic parameter of the point on the argument curv. | |

178 | -- PntSol is the tangency point on the solution curv. | |

179 | -- PntArg is the tangency point on the argument curv. | |

180 | -- Exceptions | |

181 | -- Standard_OutOfRange if Index is less than zero or | |

182 | -- greater than the number of solutions computed by this algorithm. | |

183 | -- StdFail_NotDone if the construction fails. | |

184 | ||

185 | CenterOn3 (me ; | |

186 | Index : Integer from Standard; | |

187 | ParArg : out Real from Standard; | |

188 | PntSol : out Pnt2d from gp ) | |

189 | raises OutOfRange, NotDone | |

190 | is static; | |

191 | ---Purpose: Returns the center PntSol on the second argument (i.e. | |

192 | -- line or circle) of the solution of index Index computed by | |

193 | -- this algorithm. | |

194 | -- ParArg is the intrinsic parameter of the point on the argument curv. | |

195 | -- PntSol is the center point of the solution curv. | |

196 | -- PntArg is the projection of PntSol on the argument curv. | |

197 | -- Exceptions: | |

198 | -- Standard_OutOfRange if Index is less than zero or | |

199 | -- greater than the number of solutions computed by this algorithm. | |

200 | -- StdFail_NotDone if the construction fails. | |

201 | ||

202 | IsTheSame1(me ; | |

203 | Index : Integer from Standard) returns Boolean from Standard | |

204 | raises OutOfRange, NotDone | |

205 | is static; | |

206 | ---Purpose: Returns true if the solution of index Index and the first | |

207 | -- argument of this algorithm are the same (i.e. there are 2 | |

208 | -- identical circles). | |

209 | -- If Rarg is the radius of the first argument, Rsol is the | |

210 | -- radius of the solution and dist is the distance between | |

211 | -- the two centers, we consider the two circles to be | |

212 | -- identical if |Rarg - Rsol| and dist are less than | |

213 | -- or equal to the tolerance criterion given at the time of | |

214 | -- construction of this algorithm. | |

215 | -- OutOfRange is raised if Index is greater than the number of solutions. | |

216 | -- notDone is raised if the construction algorithm did not succeed. | |

217 | ||

218 | fields | |

219 | ||

220 | WellDone : Boolean from Standard; | |

221 | -- True if the algorithm succeeded. | |

222 | ||

223 | NbrSol : Integer from Standard; | |

224 | -- The number of possible solutions. We have to decide about the | |

225 | -- status of the multiple solutions... | |

226 | ||

227 | cirsol : Array1OfCirc2d from TColgp; | |

228 | ---Purpose : The solutions. | |

229 | ||

230 | qualifier1 : Array1OfPosition from GccEnt; | |

231 | -- The qualifiers of the first argument. | |

232 | ||

233 | TheSame1 : Array1OfInteger from TColStd; | |

234 | ||

235 | pnttg1sol : Array1OfPnt2d from TColgp; | |

236 | -- The tangency point between the solution and the first argument on | |

237 | -- the solution. | |

238 | ||

239 | par1sol : Array1OfReal from TColStd; | |

240 | -- The parameter of the tangency point between the solution and the | |

241 | -- first argument on the solution. | |

242 | ||

243 | pararg1 : Array1OfReal from TColStd; | |

244 | -- The parameter of the tangency point between the solution and the first | |

245 | -- argument on the first argument. | |

246 | ||

247 | pntcen3 : Array1OfPnt2d from TColgp; | |

248 | -- The center point of the solution on the first argument. | |

249 | ||

250 | parcen3 : Array1OfReal from TColStd; | |

251 | -- The parameter of the center point of the solution on the second | |

252 | -- argument. | |

253 | ||

254 | end Circ2dTanOnRad; | |

255 | ||

256 |