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

b311480e | 1 | -- Created on: 1993-04-21 |

2 | -- Created by: Bruno DUMORTIER | |

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 SurfaceOfRevolution from Adaptor3d inherits Surface from Adaptor3d | |

18 | ||

19 | ||

20 | --- Purpose : This class defines a complete surface of revolution. | |

21 | -- The surface is obtained by rotating a curve a complete revolution | |

22 | -- about an axis. The curve and the axis must be in the same plane. | |

23 | -- If the curve and the axis are not in the same plane it is always | |

24 | -- possible to be in the previous case after a cylindrical projection | |

25 | -- of the curve in a referenced plane. | |

26 | -- For a complete surface of revolution the parametric range is | |

27 | -- 0 <= U <= 2*PI. -- | |

28 | -- The parametric range for V is defined with the revolved curve. | |

29 | -- The origin of the U parametrization is given by the position | |

30 | -- of the revolved curve (reference). The direction of the revolution | |

31 | -- axis defines the positive sense of rotation (trigonometric sense) | |

32 | -- corresponding to the increasing of the parametric value U. | |

33 | -- The derivatives are always defined for the u direction. | |

34 | -- For the v direction the definition of the derivatives depends on | |

35 | -- the degree of continuity of the referenced curve. | |

36 | ||

37 | ||

38 | ||

39 | uses | |

40 | Array1OfReal from TColStd, | |

41 | Shape from GeomAbs, | |

42 | SurfaceType from GeomAbs, | |

43 | Vec from gp, | |

44 | Pnt from gp, | |

45 | Pln from gp, | |

46 | Cone from gp, | |

47 | Cylinder from gp, | |

48 | Sphere from gp, | |

49 | Torus from gp, | |

50 | Ax3 from gp, | |

51 | Ax1 from gp, | |

52 | Dir from gp, | |

53 | BezierSurface from Geom, | |

54 | BSplineSurface from Geom, | |

55 | HSurface from Adaptor3d, | |

56 | HCurve from Adaptor3d | |

57 | ||

58 | raises | |

59 | ||

60 | OutOfRange from Standard, | |

61 | NoSuchObject from Standard, | |

62 | DomainError from Standard | |

63 | ||

64 | is | |

65 | -- | |

66 | -- Methods specific of SurfaceOfRevolution. | |

67 | -- | |

68 | ||

69 | Create returns SurfaceOfRevolution from Adaptor3d; | |

70 | ||

71 | ||

72 | Create(C : HCurve from Adaptor3d) returns SurfaceOfRevolution from Adaptor3d; | |

73 | ---Purpose: The Curve is loaded. | |

74 | ||

75 | Create(C : HCurve from Adaptor3d; V : Ax1 from gp) | |

76 | returns SurfaceOfRevolution from Adaptor3d; | |

77 | ---Purpose: The Curve and the Direction are loaded. | |

78 | ||

79 | ||

80 | Load( me : in out ; C : HCurve from Adaptor3d) | |

81 | ---Purpose: Changes the Curve | |

82 | is static; | |

83 | ||

84 | Load( me : in out ; V : Ax1 from gp) | |

85 | ---Purpose: Changes the Direction | |

86 | is static; | |

87 | ||

88 | ||

89 | AxeOfRevolution( me) returns Ax1 from gp | |

90 | is redefined static; | |

91 | ||

92 | ||

93 | -- | |

94 | -- Implementation of Surface from Adaptor3d methods. | |

95 | -- | |

96 | ||

97 | -- | |

98 | -- Global methods - Apply to the whole surface. | |

99 | -- | |

100 | ||

101 | FirstUParameter(me) returns Real | |

102 | is redefined static; | |

103 | ||

104 | LastUParameter(me) returns Real | |

105 | is redefined static; | |

106 | ||

107 | FirstVParameter(me) returns Real | |

108 | is redefined static; | |

109 | ||

110 | LastVParameter(me) returns Real | |

111 | is redefined static; | |

112 | ||

113 | UContinuity(me) returns Shape from GeomAbs | |

114 | is redefined static; | |

115 | ||

116 | VContinuity(me) returns Shape from GeomAbs | |

117 | ---Purpose: Return CN. | |

118 | is redefined static; | |

119 | ||

120 | NbUIntervals(me; S : Shape from GeomAbs) returns Integer | |

121 | ---Purpose: Returns the number of U intervals for continuity | |

122 | -- <S>. May be one if UContinuity(me) >= <S> | |

123 | is redefined static; | |

124 | ||

125 | NbVIntervals(me; S : Shape from GeomAbs) returns Integer | |

126 | ---Purpose: Returns the number of V intervals for continuity | |

127 | -- <S>. May be one if VContinuity(me) >= <S> | |

128 | is redefined static; | |

129 | ||

130 | UIntervals(me; T : in out Array1OfReal from TColStd; | |

131 | S : Shape from GeomAbs ) | |

132 | ---Purpose: Returns the intervals with the requested continuity | |

133 | -- in the U direction. | |

134 | raises | |

135 | OutOfRange from Standard -- if the Length of the array does | |

136 | -- have enought slots to accomodate | |

137 | -- the result. | |

138 | is redefined static ; | |

139 | ||

140 | VIntervals(me; T : in out Array1OfReal from TColStd; | |

141 | S : Shape from GeomAbs ) | |

142 | ---Purpose: Returns the intervals with the requested continuity | |

143 | -- in the V direction. | |

144 | raises | |

145 | OutOfRange from Standard -- if the Length of the array does | |

146 | -- have enought slots to accomodate | |

147 | -- the result. | |

148 | is redefined static ; | |

149 | ||

150 | UTrim(me; First, Last, Tol : Real) returns HSurface from Adaptor3d | |

151 | ---Purpose: Returns a surface trimmed in the U direction | |

152 | -- equivalent of <me> between | |

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

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

155 | raises | |

156 | OutOfRange from Standard | |

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

158 | is redefined static ; | |

159 | ||

160 | VTrim(me; First, Last, Tol : Real) returns HSurface from Adaptor3d | |

161 | ---Purpose: Returns a surface trimmed in the V direction between | |

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

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

164 | raises | |

165 | OutOfRange from Standard | |

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

167 | is redefined static ; | |

168 | ||

169 | IsUClosed(me) returns Boolean | |

170 | is redefined static; | |

171 | ||

172 | IsVClosed(me) returns Boolean | |

173 | is redefined static; | |

174 | ||

175 | IsUPeriodic(me) returns Boolean | |

176 | is redefined static; | |

177 | ||

178 | UPeriod(me) returns Real | |

179 | raises | |

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

181 | is redefined static; | |

182 | ||

183 | IsVPeriodic(me) returns Boolean | |

184 | is redefined static; | |

185 | ||

186 | VPeriod(me) returns Real | |

187 | raises | |

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

189 | is redefined static; | |

190 | ||

191 | Value (me; U, V : Real) returns Pnt from gp | |

192 | --- Purpose : Computes the point of parameters U,V on the surface. | |

193 | is redefined static; | |

194 | ||

195 | D0 (me; U, V : Real; P : out Pnt from gp) | |

196 | --- Purpose : Computes the point of parameters U,V on the surface. | |

197 | is redefined static; | |

198 | ||

199 | D1 (me; U, V : Real; P : out Pnt from gp; D1U, D1V : out Vec from gp) | |

200 | --- Purpose : Computes the point and the first derivatives on | |

201 | -- the surface. | |

202 | raises DomainError from Standard | |

203 | --- Purpose : Raised if the continuity of the current | |

204 | -- intervals is not C1. | |

205 | is redefined static; | |

206 | ||

207 | D2 (me; U, V : Real; | |

208 | P : out Pnt from gp; | |

209 | D1U, D1V, D2U, D2V, D2UV : out Vec from gp) | |

210 | --- Purpose : Computes the point, the first and second | |

211 | -- derivatives on the surface. | |

212 | raises DomainError from Standard | |

213 | --- Purpose : Raised if the continuity of the current | |

214 | -- intervals is not C2. | |

215 | is redefined static; | |

216 | ||

217 | D3 (me; U, V : Real; | |

218 | P : out Pnt from gp; | |

219 | D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV : out Vec from gp) | |

220 | --- Purpose : Computes the point, the first, second and third | |

221 | -- derivatives on the surface. | |

222 | raises DomainError from Standard | |

223 | --- Purpose : Raised if the continuity of the current | |

224 | -- intervals is not C3. | |

225 | is redefined static; | |

226 | ||

227 | DN (me; U, V : Real; Nu, Nv : Integer) returns Vec from gp | |

228 | --- Purpose : Computes the derivative of order Nu | |

229 | -- in the direction U and Nv in the direction V | |

230 | -- at the point P(U, V). | |

231 | raises DomainError from Standard, | |

232 | --- Purpose : Raised if the current U interval is not not CNu | |

233 | -- and the current V interval is not CNv. | |

234 | OutOfRange from Standard | |

235 | --- Purpose : Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. | |

236 | is redefined static; | |

237 | ||

238 | UResolution(me; R3d : Real ) returns Real | |

239 | ---Purpose : Returns the parametric U resolution corresponding | |

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

241 | is redefined static; | |

242 | ||

243 | VResolution(me; R3d : Real ) returns Real | |

244 | ---Purpose : Returns the parametric V resolution corresponding | |

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

246 | is redefined static; | |

247 | ||

248 | GetType(me) returns SurfaceType from GeomAbs | |

249 | ---Purpose: Returns the type of the surface : Plane, Cylinder, | |

250 | -- Cone, Sphere, Torus, BezierSurface, | |

251 | -- BSplineSurface, SurfaceOfRevolution, | |

252 | -- SurfaceOfExtrusion, OtherSurface | |

253 | is redefined static; | |

254 | ||

255 | -- | |

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

257 | -- the corresponding type. | |

258 | -- | |

259 | ||

260 | Plane(me) returns Pln from gp | |

261 | raises NoSuchObject from Standard | |

262 | is redefined static; | |

263 | ||

264 | Cylinder(me) returns Cylinder from gp | |

265 | raises NoSuchObject from Standard | |

266 | is redefined static; | |

267 | ||

268 | Cone(me) returns Cone from gp | |

269 | raises NoSuchObject from Standard | |

270 | ---Purpose : Apex of the Cone = Cone.Position().Location() | |

271 | -- ==> ReferenceRadius = 0. | |

272 | is redefined static; | |

273 | ||

274 | Sphere(me) returns Sphere from gp | |

275 | raises NoSuchObject from Standard | |

276 | is redefined static; | |

277 | ||

278 | Torus(me) returns Torus from gp | |

279 | raises NoSuchObject from Standard | |

280 | is redefined static; | |

281 | ||

282 | ||

283 | UDegree(me) returns Integer | |

284 | raises NoSuchObject from Standard | |

285 | is redefined static; | |

286 | ||

287 | NbUPoles(me) returns Integer | |

288 | raises NoSuchObject from Standard | |

289 | is redefined static; | |

290 | ||

291 | VDegree(me) returns Integer | |

292 | raises NoSuchObject from Standard | |

293 | is redefined static; | |

294 | ||

295 | NbVPoles(me) returns Integer | |

296 | raises NoSuchObject from Standard | |

297 | is redefined static; | |

298 | ||

299 | NbUKnots(me) returns Integer | |

300 | raises | |

301 | NoSuchObject from Standard | |

302 | is redefined static; | |

303 | ||

304 | ||

305 | NbVKnots(me) returns Integer | |

306 | raises | |

307 | NoSuchObject from Standard | |

308 | is redefined static; | |

309 | ||

310 | ||

311 | IsURational(me) returns Boolean | |

312 | raises | |

313 | NoSuchObject from Standard | |

314 | is redefined static; | |

315 | ||

316 | IsVRational(me) returns Boolean | |

317 | raises | |

318 | NoSuchObject from Standard | |

319 | is redefined static; | |

320 | ||

321 | ||

322 | Bezier(me) returns BezierSurface from Geom | |

323 | raises | |

324 | NoSuchObject from Standard | |

325 | is redefined static; | |

326 | ||

327 | BSpline(me) returns BSplineSurface from Geom | |

328 | raises | |

329 | NoSuchObject from Standard | |

330 | is redefined static; | |

331 | ||

332 | Axis(me) returns Ax3 from gp | |

333 | raises | |

334 | NoSuchObject from Standard -- only for SurfaceOfRevolution | |

335 | is static; | |

336 | ||

337 | Direction(me) returns Dir from gp | |

338 | raises | |

339 | NoSuchObject from Standard -- only for SurfaceOfExtrusion | |

340 | is redefined static; | |

341 | ||

342 | BasisCurve(me) returns HCurve from Adaptor3d | |

343 | raises | |

344 | NoSuchObject from Standard | |

345 | -- Only for SurfaceOfExtrusion and SurfaceOfRevolution | |

346 | is redefined static; | |

347 | fields | |

348 | ||

349 | myBasisCurve : HCurve from Adaptor3d; | |

350 | myAxis : Ax1 from gp; | |

351 | myHaveAxis : Boolean from Standard; | |

352 | myAxeRev : Ax3 from gp; | |

353 | ||

354 | ||

355 | end SurfaceOfRevolution; |