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

b311480e | 1 | -- Created on: 1992-04-03 |

2 | -- Created by: Isabelle GRIGNON | |

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 | -- |

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 | generic class PWalking from IntWalk ( | |

18 | ThePSurface as any; | |

19 | ThePSurfaceTool as any) -- as PSurfaceTool from IntWalk(ThePSurface) | |

20 | ||

21 | ||

22 | ---Purpose: This class implements an algorithm to determine the | |

b1c5c4e6 | 23 | -- intersection between 2 parametrized surfaces, marching from |

7fd59977 | 24 | -- a starting point. The intersection line |

b1c5c4e6 | 25 | -- starts and ends on the natural surface's boundaries . |

7fd59977 | 26 | |

27 | ||

28 | uses XY from gp, | |

29 | StatusDeflection from IntWalk, | |

30 | ConstIsoparametric from IntImp, | |

31 | Array1OfReal from TColStd, | |

32 | PntOn2S from IntSurf, | |

33 | LineOn2S from IntSurf, | |

34 | Dir from gp, | |

00302ba4 | 35 | Dir2d from gp, |

36 | Pnt from gp | |

7fd59977 | 37 | |

38 | ||

39 | raises OutOfRange from Standard, | |

40 | NotDone from StdFail | |

41 | ||

42 | ||

43 | class TheInt2S instantiates Int2S from IntImp | |

44 | (ThePSurface, ThePSurfaceTool); | |

45 | ||

46 | is | |

47 | ||

48 | ||

49 | Create ( Caro1 , | |

50 | Caro2 : ThePSurface ; | |

51 | TolTangency, | |

52 | Epsilon, | |

53 | Deflection, | |

54 | Increment : Real from Standard) | |

55 | ||

56 | ---Purpose: Constructor used to set the data to compute intersection | |

57 | -- lines between Caro1 and Caro2. | |

58 | -- Deflection is the maximum deflection admitted between two | |

59 | -- consecutive points on the resulting polyline. | |

60 | -- TolTangency is the tolerance to find a tangent point. | |

61 | -- Func is the criterion which has to be evaluated at each | |

62 | -- solution point (each point of the line). | |

63 | -- It is necessary to call the Perform method to compute | |

64 | -- the intersection lines. | |

b1c5c4e6 | 65 | -- The line found starts at a point on or in 2 natural domains |

66 | -- of surfaces. It can be closed in the | |

67 | -- standard case if it is open it stops and begins at the | |

68 | -- border of one of the domains. If an open line | |

69 | -- stops at the middle of a domain, one stops at the tangent point. | |

70 | -- Epsilon is SquareTolerance of points confusion. | |

7fd59977 | 71 | |

72 | returns PWalking; | |

73 | ||

74 | ||

75 | Create ( Caro1 , | |

76 | Caro2 : ThePSurface ; | |

77 | TolTangency, | |

78 | Epsilon, | |

79 | Deflection, | |

80 | Increment : Real from Standard; | |

81 | U1,V1,U2,V2 :Real from Standard) | |

82 | ||

83 | ---Purpose: Returns the intersection line containing the exact | |

84 | -- point Poin. This line is a polygonal line. | |

85 | -- Deflection is the maximum deflection admitted between two | |

86 | -- consecutive points on the resulting polyline. | |

87 | -- TolTangency is the tolerance to find a tangent point. | |

88 | -- Func is the criterion which has to be evaluated at each | |

89 | -- solution point (each point of the line). | |

b1c5c4e6 | 90 | -- The line found starts at a point on or in 2 natural domains |

91 | -- of surfaces. It can be closed in the | |

92 | -- standard case if it is open it stops and begins at the | |

93 | -- border of one of the domains. If an open line | |

94 | -- stops at the middle of a domain, one stops at the tangent point. | |

95 | -- Epsilon is SquareTolerance of points confusion. | |

7fd59977 | 96 | |

97 | returns PWalking; | |

98 | ||

99 | ||

100 | Perform(me :in out;ParDep : Array1OfReal from TColStd) | |

101 | ||

b1c5c4e6 | 102 | ---Purpose: calculate the line of intersection |

7fd59977 | 103 | |

104 | is static; | |

105 | ||

106 | Perform(me :in out;ParDep : Array1OfReal from TColStd; | |

107 | u1min,v1min,u2min,v2min,u1max,v1max,u2max,v2max: Real from Standard) | |

108 | ||

b1c5c4e6 | 109 | ---Purpose: calculate the line of intersection. The regulation |

110 | -- of steps is done using min and max values on u and | |

111 | -- v. (if this data is not presented as in the | |

112 | -- previous method, the initial steps are calculated | |

113 | -- starting from min and max uv of faces). | |

7fd59977 | 114 | |

115 | is static; | |

116 | ||

117 | ||

118 | PerformFirstPoint(me :in out; | |

119 | ParDep : Array1OfReal from TColStd; | |

120 | FirstPoint: in out PntOn2S from IntSurf) | |

121 | ||

b1c5c4e6 | 122 | ---Purpose: calculate the first point of a line of intersection |

7fd59977 | 123 | -- |

124 | ||

125 | returns Boolean from Standard | |

126 | ||

127 | is static; | |

128 | ||

129 | ||

130 | IsDone(me) | |

131 | ||

132 | ---Purpose: Returns true if the calculus was successful. | |

133 | ||

134 | returns Boolean from Standard | |

135 | ---C++: inline | |

136 | ||

137 | is static; | |

138 | ||

139 | ||

140 | NbPoints(me) | |

141 | ||

142 | ---Purpose: Returns the number of points of the resulting polyline. | |

143 | -- An exception is raised if IsDone returns False. | |

144 | ||

145 | returns Integer from Standard | |

146 | ---C++: inline | |

147 | ||

148 | raises NotDone from StdFail | |

149 | ||

150 | is static; | |

151 | ||

152 | ||

153 | Value(me ; Index : Integer from Standard) | |

154 | ||

155 | ---Purpose: Returns the point of range Index on the polyline. | |

156 | -- An exception is raised if IsDone returns False. | |

157 | -- An exception is raised if Index<=0 or Index>NbPoints. | |

158 | ||

159 | returns PntOn2S from IntSurf | |

160 | ---C++: inline | |

161 | ---C++: return const& | |

162 | ||

163 | raises NotDone from StdFail, | |

164 | OutOfRange from Standard | |

165 | ||

166 | is static; | |

167 | ||

168 | ||

169 | Line(me) | |

170 | ||

171 | returns mutable LineOn2S from IntSurf | |

172 | ---C++: inline | |

173 | ---C++: return const& | |

174 | ||

175 | raises NotDone from StdFail | |

176 | is static; | |

177 | ||

178 | ||

179 | TangentAtFirst(me) | |

180 | ||

181 | ---Purpose: Returns True if the surface are tangent at the first point | |

182 | -- of the line. | |

183 | -- An exception is raised if IsDone returns False. | |

184 | ||

185 | returns Boolean from Standard | |

186 | ---C++: inline | |

187 | ||

188 | raises NotDone from StdFail | |

189 | ||

190 | is static; | |

191 | ||

192 | ||

193 | TangentAtLast(me) | |

194 | ||

195 | ---Purpose: Returns true if the surface are tangent at the last point | |

196 | -- of the line. | |

197 | -- An exception is raised if IsDone returns False. | |

198 | ||

199 | returns Boolean from Standard | |

200 | ---C++: inline | |

201 | ||

202 | raises NotDone from StdFail | |

203 | is static; | |

204 | ||

205 | ||

206 | IsClosed(me) | |

207 | ||

208 | ---Purpose: Returns True if the line is closed. | |

209 | -- An exception is raised if IsDone returns False. | |

210 | ||

211 | returns Boolean from Standard | |

212 | ---C++: inline | |

213 | ||

214 | raises NotDone from StdFail | |

215 | is static; | |

216 | ||

217 | ||

218 | TangentAtLine(me; Index: out Integer from Standard) | |

219 | ||

220 | returns Dir from gp | |

221 | ---C++: return const& | |

222 | ---C++: inline | |

223 | ||

224 | raises NotDone from StdFail | |

225 | is static; | |

226 | ||

227 | ||

228 | --private | |

229 | ||

230 | TestDeflection(me : in out) | |

231 | ||

232 | returns StatusDeflection from IntWalk | |

233 | is static; | |

234 | ||

235 | ||

236 | TestArret(me : in out; DejaReparti : Boolean from Standard; | |

237 | Param : in out Array1OfReal from TColStd; | |

238 | ChoixIso : out ConstIsoparametric from IntImp) | |

239 | ||

240 | ||

241 | returns Boolean from Standard | |

242 | is static; | |

243 | ||

244 | ||

245 | RepartirOuDiviser(me : in out; DejaReparti : in out Boolean from Standard; | |

246 | ChoixIso : out ConstIsoparametric from IntImp; | |

247 | Arrive : in out Boolean from Standard ) | |

248 | ||

249 | is static; | |

250 | ||

251 | AddAPoint ( me : in out ; | |

00302ba4 | 252 | line : in out LineOn2S from IntSurf ; |

253 | POn2S : PntOn2S from IntSurf ) ; | |

254 | ---C++: inline | |

255 | ||

7fd59977 | 256 | ExtendLineInCommonZone(me: in out; theChoixIso: ConstIsoparametric from IntImp; |

00302ba4 | 257 | theDirectionFlag: Boolean from Standard) |

258 | returns Boolean from Standard | |

259 | is private; | |

260 | ||

261 | DistanceMinimizeByGradient( me : in out; | |

262 | theASurf1 , theASurf2 : ThePSurface ; | |

263 | theU1, theV1, theU2, theV2: out Real from Standard; | |

264 | theStep0U1V1: Real from Standard = 1.0e-6; | |

265 | theStep0U2V2: Real from Standard = 1.0e-6) | |

266 | returns Boolean from Standard | |

267 | is private; | |

c2c2f2b6 | 268 | -- Finds one intersection point of two given surfaces with given |

269 | -- initial point. | |

00302ba4 | 270 | |

271 | DistanceMinimizeByExtrema(me : in out; | |

272 | theASurf1 : ThePSurface ; | |

273 | theP0 : Pnt from gp; | |

274 | theU0, theV0: out Real from Standard; | |

275 | theStep0U: Real from Standard = 1.0; | |

276 | theStep0V: Real from Standard = 1.0) | |

277 | returns Boolean from Standard | |

278 | is private; | |

c2c2f2b6 | 279 | -- Finds one intersection point of two given surfaces with given |

280 | -- initial point. | |

00302ba4 | 281 | |

c2c2f2b6 | 282 | SeekPointOnBoundary(me : in out; |

283 | theASurf1 , theASurf2 : ThePSurface ; | |

284 | theU1, theV1, theU2, theV2: Real from Standard; | |

285 | isTheFirst : Boolean from Standard) | |

286 | returns Boolean from Standard | |

287 | is private; | |

288 | -- Unites and correctly coordinates of work of | |

289 | -- "DistanceMinimizeByGradient" and "DistanceMinimizeByExtrema" functions. | |

290 | ||

291 | ||

292 | PutToBoundary( me : in out; | |

293 | theASurf1 , theASurf2 : ThePSurface) | |

294 | -- Tries to extend existing intersection line | |

295 | -- (as set of points) to surface's boundaries, | |

296 | -- if it is possibly. | |

297 | -- If line is scienter far from boundaries | |

298 | -- or is (almost) parralel with some boundary, | |

299 | -- extending is not required. | |

300 | returns Boolean from Standard; | |

301 | ||

302 | ||

00302ba4 | 303 | SeekAdditionalPoints( me : in out; |

304 | theASurf1 , theASurf2 : ThePSurface; | |

305 | theMinNbPoints : Integer from Standard) | |

306 | returns Boolean from Standard; | |

c2c2f2b6 | 307 | -- Unites and correctly coordinates of work of |

308 | -- "DistanceMinimizeByGradient" and "DistanceMinimizeByExtrema" functions. | |

7fd59977 | 309 | |

310 | fields | |

311 | ||

312 | done : Boolean from Standard; | |

313 | line : LineOn2S from IntSurf; | |

314 | close : Boolean from Standard; | |

315 | tgfirst : Boolean from Standard; | |

316 | tglast : Boolean from Standard; | |

317 | indextg : Integer from Standard; | |

318 | tgdir : Dir from gp; | |

319 | ||

b1c5c4e6 | 320 | fleche : Real from Standard; -- max possible vector |

321 | pasMax : Real from Standard; -- max possible uv ratio | |

322 | tolconf : Real from Standard; -- tol of confusion of 2 points | |

323 | pasuv : Real from Standard[4];-- uv step on squares | |

324 | pasSav : Real from Standard[4];-- first saved step | |

325 | pasInit : Real from Standard[4];-- saving of steps | |

7fd59977 | 326 | |

327 | Um1 : Real from Standard; | |

328 | UM1 : Real from Standard; | |

329 | Vm1 : Real from Standard; | |

330 | VM1 : Real from Standard; | |

331 | ||

332 | Um2 : Real from Standard; | |

333 | UM2 : Real from Standard; | |

334 | Vm2 : Real from Standard; | |

335 | VM2 : Real from Standard; | |

336 | ||

337 | ResoU1 : Real from Standard; | |

338 | ResoU2 : Real from Standard; | |

339 | ResoV1 : Real from Standard; | |

340 | ResoV2 : Real from Standard; | |

341 | ||

342 | sensCheminement : Integer from Standard; | |

343 | choixIsoSav : ConstIsoparametric from IntImp; | |

b1c5c4e6 | 344 | -- save 1st iso choice |

7fd59977 | 345 | previousPoint : PntOn2S from IntSurf; |

b1c5c4e6 | 346 | -- previous intersection point |

7fd59977 | 347 | previoustg : Boolean from Standard; |

348 | previousd : Dir from gp; | |

349 | previousd1 : Dir2d from gp; | |

350 | previousd2 : Dir2d from gp; | |

351 | firstd1 : Dir2d from gp; | |

352 | firstd2 : Dir2d from gp; | |

353 | ||

354 | myIntersectionOn2S : TheInt2S ; | |

1ef32e96 RL |
355 | STATIC_BLOCAGE_SUR_PAS_TROP_GRAND : Integer from Standard; |

356 | STATIC_PRECEDENT_INFLEXION : Integer from Standard; | |

7fd59977 | 357 | end PWalking; |