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

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

2 | -- Created by: Bruno DUMORTIER | |

3 | -- Copyright (c) 1993-1999 Matra Datavision | |

4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS | |

5 | -- | |

6 | -- The content of this file is subject to the Open CASCADE Technology Public | |

7 | -- License Version 6.5 (the "License"). You may not use the content of this file | |

8 | -- except in compliance with the License. Please obtain a copy of the License | |

9 | -- at http://www.opencascade.org and read it completely before using this file. | |

10 | -- | |

11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its | |

12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. | |

13 | -- | |

14 | -- The Original Code and all software distributed under the License is | |

15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the | |

16 | -- Initial Developer hereby disclaims all such warranties, including without | |

17 | -- limitation, any warranties of merchantability, fitness for a particular | |

18 | -- purpose or non-infringement. Please see the License for the specific terms | |

19 | -- and conditions governing the rights and limitations under the License. | |

20 | ||

7fd59977 | 21 | |

22 | ||

23 | class SurfaceOfRevolution from Adaptor3d inherits Surface from Adaptor3d | |

24 | ||

25 | ||

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

42 | ||

43 | ||

44 | ||

45 | uses | |

46 | Array1OfReal from TColStd, | |

47 | Shape from GeomAbs, | |

48 | SurfaceType from GeomAbs, | |

49 | Vec from gp, | |

50 | Pnt from gp, | |

51 | Pln from gp, | |

52 | Cone from gp, | |

53 | Cylinder from gp, | |

54 | Sphere from gp, | |

55 | Torus from gp, | |

56 | Ax3 from gp, | |

57 | Ax1 from gp, | |

58 | Dir from gp, | |

59 | BezierSurface from Geom, | |

60 | BSplineSurface from Geom, | |

61 | HSurface from Adaptor3d, | |

62 | HCurve from Adaptor3d | |

63 | ||

64 | raises | |

65 | ||

66 | OutOfRange from Standard, | |

67 | NoSuchObject from Standard, | |

68 | DomainError from Standard | |

69 | ||

70 | is | |

71 | -- | |

72 | -- Methods specific of SurfaceOfRevolution. | |

73 | -- | |

74 | ||

75 | Create returns SurfaceOfRevolution from Adaptor3d; | |

76 | ||

77 | ||

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

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

80 | ||

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

82 | returns SurfaceOfRevolution from Adaptor3d; | |

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

84 | ||

85 | ||

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

87 | ---Purpose: Changes the Curve | |

88 | is static; | |

89 | ||

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

91 | ---Purpose: Changes the Direction | |

92 | is static; | |

93 | ||

94 | ||

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

96 | is redefined static; | |

97 | ||

98 | ||

99 | -- | |

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

101 | -- | |

102 | ||

103 | -- | |

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

105 | -- | |

106 | ||

107 | FirstUParameter(me) returns Real | |

108 | is redefined static; | |

109 | ||

110 | LastUParameter(me) returns Real | |

111 | is redefined static; | |

112 | ||

113 | FirstVParameter(me) returns Real | |

114 | is redefined static; | |

115 | ||

116 | LastVParameter(me) returns Real | |

117 | is redefined static; | |

118 | ||

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

120 | is redefined static; | |

121 | ||

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

123 | ---Purpose: Return CN. | |

124 | is redefined static; | |

125 | ||

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

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

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

129 | is redefined static; | |

130 | ||

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

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

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

134 | is redefined static; | |

135 | ||

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

137 | S : Shape from GeomAbs ) | |

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

139 | -- in the U direction. | |

140 | raises | |

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

142 | -- have enought slots to accomodate | |

143 | -- the result. | |

144 | is redefined static ; | |

145 | ||

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

147 | S : Shape from GeomAbs ) | |

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

149 | -- in the V direction. | |

150 | raises | |

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

152 | -- have enought slots to accomodate | |

153 | -- the result. | |

154 | is redefined static ; | |

155 | ||

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

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

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

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

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

161 | raises | |

162 | OutOfRange from Standard | |

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

164 | is redefined static ; | |

165 | ||

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

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

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

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

170 | raises | |

171 | OutOfRange from Standard | |

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

173 | is redefined static ; | |

174 | ||

175 | IsUClosed(me) returns Boolean | |

176 | is redefined static; | |

177 | ||

178 | IsVClosed(me) returns Boolean | |

179 | is redefined static; | |

180 | ||

181 | IsUPeriodic(me) returns Boolean | |

182 | is redefined static; | |

183 | ||

184 | UPeriod(me) returns Real | |

185 | raises | |

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

187 | is redefined static; | |

188 | ||

189 | IsVPeriodic(me) returns Boolean | |

190 | is redefined static; | |

191 | ||

192 | VPeriod(me) returns Real | |

193 | raises | |

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

195 | is redefined static; | |

196 | ||

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

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

199 | is redefined static; | |

200 | ||

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

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

203 | is redefined static; | |

204 | ||

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

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

207 | -- the surface. | |

208 | raises DomainError from Standard | |

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

210 | -- intervals is not C1. | |

211 | is redefined static; | |

212 | ||

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

214 | P : out Pnt from gp; | |

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

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

217 | -- derivatives on the surface. | |

218 | raises DomainError from Standard | |

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

220 | -- intervals is not C2. | |

221 | is redefined static; | |

222 | ||

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

224 | P : out Pnt from gp; | |

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

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

227 | -- derivatives on the surface. | |

228 | raises DomainError from Standard | |

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

230 | -- intervals is not C3. | |

231 | is redefined static; | |

232 | ||

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

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

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

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

237 | raises DomainError from Standard, | |

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

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

240 | OutOfRange from Standard | |

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

242 | is redefined static; | |

243 | ||

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

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

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

247 | is redefined static; | |

248 | ||

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

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

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

252 | is redefined static; | |

253 | ||

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

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

256 | -- Cone, Sphere, Torus, BezierSurface, | |

257 | -- BSplineSurface, SurfaceOfRevolution, | |

258 | -- SurfaceOfExtrusion, OtherSurface | |

259 | is redefined static; | |

260 | ||

261 | -- | |

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

263 | -- the corresponding type. | |

264 | -- | |

265 | ||

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

267 | raises NoSuchObject from Standard | |

268 | is redefined static; | |

269 | ||

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

271 | raises NoSuchObject from Standard | |

272 | is redefined static; | |

273 | ||

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

275 | raises NoSuchObject from Standard | |

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

277 | -- ==> ReferenceRadius = 0. | |

278 | is redefined static; | |

279 | ||

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

281 | raises NoSuchObject from Standard | |

282 | is redefined static; | |

283 | ||

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

285 | raises NoSuchObject from Standard | |

286 | is redefined static; | |

287 | ||

288 | ||

289 | UDegree(me) returns Integer | |

290 | raises NoSuchObject from Standard | |

291 | is redefined static; | |

292 | ||

293 | NbUPoles(me) returns Integer | |

294 | raises NoSuchObject from Standard | |

295 | is redefined static; | |

296 | ||

297 | VDegree(me) returns Integer | |

298 | raises NoSuchObject from Standard | |

299 | is redefined static; | |

300 | ||

301 | NbVPoles(me) returns Integer | |

302 | raises NoSuchObject from Standard | |

303 | is redefined static; | |

304 | ||

305 | NbUKnots(me) returns Integer | |

306 | raises | |

307 | NoSuchObject from Standard | |

308 | is redefined static; | |

309 | ||

310 | ||

311 | NbVKnots(me) returns Integer | |

312 | raises | |

313 | NoSuchObject from Standard | |

314 | is redefined static; | |

315 | ||

316 | ||

317 | IsURational(me) returns Boolean | |

318 | raises | |

319 | NoSuchObject from Standard | |

320 | is redefined static; | |

321 | ||

322 | IsVRational(me) returns Boolean | |

323 | raises | |

324 | NoSuchObject from Standard | |

325 | is redefined static; | |

326 | ||

327 | ||

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

329 | raises | |

330 | NoSuchObject from Standard | |

331 | is redefined static; | |

332 | ||

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

334 | raises | |

335 | NoSuchObject from Standard | |

336 | is redefined static; | |

337 | ||

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

339 | raises | |

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

341 | is static; | |

342 | ||

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

344 | raises | |

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

346 | is redefined static; | |

347 | ||

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

349 | raises | |

350 | NoSuchObject from Standard | |

351 | -- Only for SurfaceOfExtrusion and SurfaceOfRevolution | |

352 | is redefined static; | |

353 | fields | |

354 | ||

355 | myBasisCurve : HCurve from Adaptor3d; | |

356 | myAxis : Ax1 from gp; | |

357 | myHaveAxis : Boolean from Standard; | |

358 | myAxeRev : Ax3 from gp; | |

359 | ||

360 | ||

361 | end SurfaceOfRevolution; |