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

b311480e | 1 | -- Created on: 1993-02-22 |

2 | -- Created by: Modelistation | |

3 | -- Copyright (c) 1993-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 CurveOnSurface from Adaptor3d inherits Curve from Adaptor3d | |

18 | ||

19 | ---Purpose: An interface between the services provided by a curve | |

20 | -- lying on a surface from the package Geom and those | |

21 | -- required of the curve by algorithms which use it. The | |

22 | -- curve is defined as a 2D curve from the Geom2d | |

23 | -- package, in the parametric space of the surface. | |

24 | ||

25 | ||

26 | uses | |

27 | Array1OfReal from TColStd, | |

28 | Pnt from gp, | |

29 | Vec from gp, | |

30 | Circ from gp, | |

31 | Elips from gp, | |

32 | Hypr from gp, | |

33 | Parab from gp, | |

34 | Lin from gp, | |

35 | CurveType from GeomAbs, | |

36 | Shape from GeomAbs, | |

37 | BezierCurve from Geom, | |

38 | BSplineCurve from Geom, | |

39 | BSplineSurface from Geom, | |

40 | HCurve from Adaptor3d, | |

41 | HCurve2d from Adaptor2d, | |

42 | HSurface from Adaptor3d, | |

54f7544d | 43 | HSequenceOfReal from TColStd, |

44 | Pnt2d from gp, | |

45 | Vec2d from gp | |

46 | ||

7fd59977 | 47 | raises NoSuchObject from Standard, |

48 | DomainError from Standard, | |

49 | OutOfRange from Standard | |

50 | ||

51 | is | |

52 | ||

53 | Create returns CurveOnSurface; | |

54 | ||

55 | Create(S : HSurface from Adaptor3d) returns CurveOnSurface; | |

56 | ||

57 | Create (C : HCurve2d from Adaptor2d; S : HSurface from Adaptor3d) | |

58 | returns CurveOnSurface; | |

59 | ---Purpose: Creates a CurveOnSurface from the 2d curve <C> and | |

60 | -- the surface <S>. | |

61 | ||

62 | Load(me : in out;S : HSurface from Adaptor3d) | |

63 | ---Purpose: Changes the surface. | |

64 | is static; | |

65 | ||

66 | Load(me : in out; C : HCurve2d from Adaptor2d) | |

67 | ---Purpose: Changes the 2d curve. | |

68 | is static; | |

69 | ||

543a9964 | 70 | Load(me : in out; C : HCurve2d from Adaptor2d; |

71 | S : HSurface from Adaptor3d) | |

72 | ---Purpose: Load both curve and surface. | |

73 | is static; | |

74 | ||

7fd59977 | 75 | GetCurve(me) returns HCurve2d from Adaptor2d |

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

77 | is static; | |

78 | ||

79 | GetSurface(me) returns HSurface from Adaptor3d | |

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

81 | is static; | |

82 | ||

83 | ChangeCurve(me : in out) returns HCurve2d from Adaptor2d | |

84 | ---C++: return & | |

85 | is static; | |

86 | ||

87 | ChangeSurface(me : in out) returns HSurface from Adaptor3d | |

88 | ---C++: return & | |

89 | is static; | |

90 | ||

91 | -- | |

92 | -- Implementation of Curve from Adaptor3d methods | |

93 | -- | |

94 | ||

95 | -- | |

96 | -- Global methods - Apply to the whole curve. | |

97 | -- | |

98 | ||

99 | FirstParameter(me) returns Real | |

100 | is redefined static; | |

101 | ||

102 | LastParameter(me) returns Real | |

103 | is redefined static; | |

104 | ||

105 | Continuity(me) returns Shape from GeomAbs | |

106 | is redefined static; | |

107 | ||

31b1749c | 108 | NbIntervals(me; S : Shape from GeomAbs) returns Integer |

7fd59977 | 109 | ---Purpose: Returns the number of intervals for continuity |

110 | -- <S>. May be one if Continuity(me) >= <S> | |

111 | is redefined static; | |

112 | ||

31b1749c | 113 | Intervals(me; T : in out Array1OfReal from TColStd; |

7fd59977 | 114 | S : Shape from GeomAbs) |

115 | ---Purpose: Stores in <T> the parameters bounding the intervals | |

116 | -- of continuity <S>. | |

117 | -- | |

118 | -- The array must provide enough room to accomodate | |

119 | -- for the parameters. i.e. T.Length() > NbIntervals() | |

120 | raises | |

121 | OutOfRange from Standard | |

122 | is redefined static; | |

123 | ||

124 | Trim(me; First, Last, Tol : Real) returns HCurve from Adaptor3d | |

125 | ---Purpose: Returns a curve equivalent of <me> between | |

126 | -- parameters <First> and <Last>. <Tol> is used to | |

127 | -- test for 3d points confusion. | |

128 | raises | |

129 | OutOfRange from Standard | |

130 | ---Purpose: If <First> >= <Last> | |

131 | is redefined static; | |

132 | ||

133 | IsClosed(me) returns Boolean | |

134 | is redefined static; | |

135 | ||

136 | IsPeriodic(me) returns Boolean | |

137 | is redefined static; | |

138 | ||

139 | Period(me) returns Real | |

140 | raises | |

141 | DomainError from Standard -- if the curve is not periodic | |

142 | is redefined static; | |

143 | ||

144 | Value(me; U : Real) returns Pnt from gp | |

145 | --- Purpose : Computes the point of parameter U on the curve. | |

146 | is redefined static; | |

147 | ||

148 | D0 (me; U : Real; P : out Pnt from gp) | |

149 | --- Purpose : Computes the point of parameter U on the curve. | |

150 | is redefined static; | |

151 | ||

152 | D1 (me; U : Real; P : out Pnt from gp ; V : out Vec from gp) | |

153 | --- Purpose : Computes the point of parameter U on the curve with its | |

154 | -- first derivative. | |

155 | raises | |

156 | DomainError from Standard | |

157 | --- Purpose : Raised if the continuity of the current interval | |

158 | -- is not C1. | |

159 | is redefined static; | |

160 | ||

161 | D2 (me; U : Real; P : out Pnt from gp; V1, V2 : out Vec from gp) | |

162 | --- Purpose : | |

163 | -- Returns the point P of parameter U, the first and second | |

164 | -- derivatives V1 and V2. | |

165 | raises | |

166 | DomainError from Standard | |

167 | --- Purpose : Raised if the continuity of the current interval | |

168 | -- is not C2. | |

169 | is redefined static; | |

170 | ||

171 | D3 (me; U : Real; P : out Pnt from gp; V1, V2, V3 : out Vec from gp) | |

172 | --- Purpose : | |

173 | -- Returns the point P of parameter U, the first, the second | |

174 | -- and the third derivative. | |

175 | raises | |

176 | DomainError from Standard | |

177 | --- Purpose : Raised if the continuity of the current interval | |

178 | -- is not C3. | |

179 | is redefined static; | |

180 | ||

181 | DN (me; U : Real; N : Integer) returns Vec from gp | |

182 | --- Purpose : | |

183 | -- The returned vector gives the value of the derivative for the | |

184 | -- order of derivation N. | |

185 | raises | |

186 | DomainError from Standard, | |

187 | --- Purpose : Raised if the continuity of the current interval | |

188 | -- is not CN. | |

189 | OutOfRange from Standard | |

190 | --- Purpose : Raised if N < 1. | |

191 | is redefined static; | |

192 | ||

193 | Resolution(me; R3d : Real) returns Real | |

194 | ---Purpose : Returns the parametric resolution corresponding | |

195 | -- to the real space resolution <R3d>. | |

196 | is redefined static; | |

197 | ||

198 | GetType(me) returns CurveType from GeomAbs | |

199 | ---Purpose: Returns the type of the curve in the current | |

200 | -- interval : Line, Circle, Ellipse, Hyperbola, | |

201 | -- Parabola, BezierCurve, BSplineCurve, OtherCurve. | |

202 | is redefined static; | |

203 | ||

204 | -- | |

205 | -- The following methods must be called when GetType returned | |

206 | -- the corresponding type. | |

207 | -- | |

208 | ||

209 | Line(me) returns Lin from gp | |

210 | raises | |

211 | NoSuchObject from Standard | |

212 | is redefined static; | |

213 | ||

214 | Circle(me) returns Circ from gp | |

215 | raises | |

216 | NoSuchObject from Standard | |

217 | is redefined static; | |

218 | ||

219 | Ellipse(me) returns Elips from gp | |

220 | raises | |

221 | NoSuchObject from Standard | |

222 | is redefined static; | |

223 | ||

224 | Hyperbola(me) returns Hypr from gp | |

225 | raises | |

226 | NoSuchObject from Standard | |

227 | is redefined static; | |

228 | ||

229 | Parabola(me) returns Parab from gp | |

230 | raises | |

231 | NoSuchObject from Standard | |

232 | is redefined static; | |

233 | ||

234 | Degree(me) returns Integer | |

235 | raises | |

236 | NoSuchObject from Standard | |

237 | is redefined static; | |

238 | ||

239 | ||

240 | IsRational(me) returns Boolean | |

241 | raises | |

242 | NoSuchObject from Standard | |

243 | is redefined static; | |

244 | ||

245 | NbPoles(me) returns Integer | |

246 | raises | |

247 | NoSuchObject from Standard | |

248 | is redefined static; | |

249 | ||

250 | ||

251 | NbKnots(me) returns Integer | |

252 | raises | |

253 | NoSuchObject from Standard | |

254 | is redefined static; | |

255 | ---Warning: will raize if this asked on a curve | |

256 | -- that is not planar | |

257 | ||

258 | Bezier(me) returns BezierCurve from Geom | |

259 | raises | |

260 | NoSuchObject from Standard | |

261 | is redefined static; | |

262 | ||

263 | BSpline(me) returns BSplineCurve from Geom | |

264 | raises | |

265 | NoSuchObject from Standard | |

266 | is redefined static; | |

267 | ||

268 | EvalKPart(me : in out) | |

269 | is static private; | |

270 | ||

271 | EvalFirstLastSurf(me : in out) | |

272 | ---Purpose: Evaluates myFirstSurf and myLastSurf | |

273 | -- for trimming the curve on surface. | |

274 | is static private; | |

275 | ||

276 | ||

277 | ---Purpose: Following methods output left-bottom and right-top points | |

278 | -- of located part on surface | |

279 | -- for trimming the curve on surface. | |

280 | ||

281 | LocatePart(me; UV : Pnt2d from gp; DUV : Vec2d from gp; | |

282 | S : HSurface from Adaptor3d; | |

283 | LeftBot, RightTop : out Pnt2d from gp) | |

284 | is static private; | |

285 | ||

286 | LocatePart_RevExt(me; UV : Pnt2d from gp; DUV : Vec2d from gp; | |

287 | S : HSurface from Adaptor3d; | |

288 | LeftBot, RightTop : out Pnt2d from gp) | |

289 | returns Boolean | |

290 | is static private; | |

291 | ||

292 | LocatePart_Offset(me; UV : Pnt2d from gp; DUV : Vec2d from gp; | |

293 | S : HSurface from Adaptor3d; | |

294 | LeftBot, RightTop : out Pnt2d from gp) | |

295 | returns Boolean | |

296 | is static private; | |

297 | ||

298 | FindBounds(me; Arr : Array1OfReal from TColStd; | |

299 | XYComp : Real from Standard; | |

300 | DUVComp : Real from Standard; | |

301 | Bnd1 : out Integer from Standard; | |

302 | Bnd2 : out Integer from Standard; | |

303 | DerIsNull : out Boolean from Standard) | |

304 | ---Purpose: Extracts the numbers of knots which equal | |

305 | -- the point and checks derivative components | |

306 | -- by zero equivalence. | |

307 | is static private; | |

308 | ||

309 | ||

310 | ||

311 | fields | |

312 | ||

313 | mySurface : HSurface from Adaptor3d; | |

314 | myCurve : HCurve2d from Adaptor2d; | |

315 | ||

316 | myType : CurveType from GeomAbs; | |

317 | myCirc : Circ from gp; | |

318 | myLin : Lin from gp; | |

319 | ||

320 | myFirstSurf : HSurface from Adaptor3d; | |

321 | myLastSurf : HSurface from Adaptor3d; | |

322 | ||

54f7544d | 323 | myIntervals : HSequenceOfReal from TColStd; |

7fd59977 | 324 | myIntCont : Shape from GeomAbs; |

325 | ||

326 | end CurveOnSurface; | |

327 | ||

328 | ||

329 | ||

330 |