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

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

2 | -- Created by: Modelistation | |

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

24 | class CurveOnSurface from Adaptor3d inherits Curve from Adaptor3d | |

25 | ||

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

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

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

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

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

31 | ||

32 | ||

33 | uses | |

34 | Array1OfReal from TColStd, | |

35 | Pnt from gp, | |

36 | Vec from gp, | |

37 | Circ from gp, | |

38 | Elips from gp, | |

39 | Hypr from gp, | |

40 | Parab from gp, | |

41 | Lin from gp, | |

42 | CurveType from GeomAbs, | |

43 | Shape from GeomAbs, | |

44 | BezierCurve from Geom, | |

45 | BSplineCurve from Geom, | |

46 | BSplineSurface from Geom, | |

47 | HCurve from Adaptor3d, | |

48 | HCurve2d from Adaptor2d, | |

49 | HSurface from Adaptor3d, | |

50 | HArray1OfReal from TColStd, | |

51 | ||

52 | Pnt2d from gp, | |

53 | Vec2d from gp | |

54 | raises NoSuchObject from Standard, | |

55 | DomainError from Standard, | |

56 | OutOfRange from Standard | |

57 | ||

58 | is | |

59 | ||

60 | Create returns CurveOnSurface; | |

61 | ||

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

63 | ||

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

65 | returns CurveOnSurface; | |

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

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

68 | ||

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

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

71 | is static; | |

72 | ||

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

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

75 | is static; | |

76 | ||

77 | GetCurve(me) returns HCurve2d from Adaptor2d | |

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

79 | is static; | |

80 | ||

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

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

83 | is static; | |

84 | ||

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

86 | ---C++: return & | |

87 | is static; | |

88 | ||

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

90 | ---C++: return & | |

91 | is static; | |

92 | ||

93 | -- | |

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

95 | -- | |

96 | ||

97 | -- | |

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

99 | -- | |

100 | ||

101 | FirstParameter(me) returns Real | |

102 | is redefined static; | |

103 | ||

104 | LastParameter(me) returns Real | |

105 | is redefined static; | |

106 | ||

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

108 | is redefined static; | |

109 | ||

110 | NbIntervals(me: in out; S : Shape from GeomAbs) returns Integer | |

111 | ---Purpose: Returns the number of intervals for continuity | |

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

113 | is redefined static; | |

114 | ||

115 | Intervals(me:in out; T : in out Array1OfReal from TColStd; | |

116 | S : Shape from GeomAbs) | |

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

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

119 | -- | |

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

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

122 | raises | |

123 | OutOfRange from Standard | |

124 | is redefined static; | |

125 | ||

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

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

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

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

130 | raises | |

131 | OutOfRange from Standard | |

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

133 | is redefined static; | |

134 | ||

135 | IsClosed(me) returns Boolean | |

136 | is redefined static; | |

137 | ||

138 | IsPeriodic(me) returns Boolean | |

139 | is redefined static; | |

140 | ||

141 | Period(me) returns Real | |

142 | raises | |

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

144 | is redefined static; | |

145 | ||

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

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

148 | is redefined static; | |

149 | ||

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

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

152 | is redefined static; | |

153 | ||

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

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

156 | -- first derivative. | |

157 | raises | |

158 | DomainError from Standard | |

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

160 | -- is not C1. | |

161 | is redefined static; | |

162 | ||

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

164 | --- Purpose : | |

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

166 | -- derivatives V1 and V2. | |

167 | raises | |

168 | DomainError from Standard | |

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

170 | -- is not C2. | |

171 | is redefined static; | |

172 | ||

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

174 | --- Purpose : | |

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

176 | -- and the third derivative. | |

177 | raises | |

178 | DomainError from Standard | |

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

180 | -- is not C3. | |

181 | is redefined static; | |

182 | ||

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

184 | --- Purpose : | |

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

186 | -- order of derivation N. | |

187 | raises | |

188 | DomainError from Standard, | |

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

190 | -- is not CN. | |

191 | OutOfRange from Standard | |

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

193 | is redefined static; | |

194 | ||

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

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

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

198 | is redefined static; | |

199 | ||

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

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

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

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

204 | is redefined static; | |

205 | ||

206 | -- | |

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

208 | -- the corresponding type. | |

209 | -- | |

210 | ||

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

212 | raises | |

213 | NoSuchObject from Standard | |

214 | is redefined static; | |

215 | ||

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

217 | raises | |

218 | NoSuchObject from Standard | |

219 | is redefined static; | |

220 | ||

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

222 | raises | |

223 | NoSuchObject from Standard | |

224 | is redefined static; | |

225 | ||

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

227 | raises | |

228 | NoSuchObject from Standard | |

229 | is redefined static; | |

230 | ||

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

232 | raises | |

233 | NoSuchObject from Standard | |

234 | is redefined static; | |

235 | ||

236 | Degree(me) returns Integer | |

237 | raises | |

238 | NoSuchObject from Standard | |

239 | is redefined static; | |

240 | ||

241 | ||

242 | IsRational(me) returns Boolean | |

243 | raises | |

244 | NoSuchObject from Standard | |

245 | is redefined static; | |

246 | ||

247 | NbPoles(me) returns Integer | |

248 | raises | |

249 | NoSuchObject from Standard | |

250 | is redefined static; | |

251 | ||

252 | ||

253 | NbKnots(me) returns Integer | |

254 | raises | |

255 | NoSuchObject from Standard | |

256 | is redefined static; | |

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

258 | -- that is not planar | |

259 | ||

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

261 | raises | |

262 | NoSuchObject from Standard | |

263 | is redefined static; | |

264 | ||

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

266 | raises | |

267 | NoSuchObject from Standard | |

268 | is redefined static; | |

269 | ||

270 | EvalKPart(me : in out) | |

271 | is static private; | |

272 | ||

273 | EvalFirstLastSurf(me : in out) | |

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

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

276 | is static private; | |

277 | ||

278 | ||

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

280 | -- of located part on surface | |

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

282 | ||

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

284 | S : HSurface from Adaptor3d; | |

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

286 | is static private; | |

287 | ||

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

289 | S : HSurface from Adaptor3d; | |

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

291 | returns Boolean | |

292 | is static private; | |

293 | ||

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

295 | S : HSurface from Adaptor3d; | |

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

297 | returns Boolean | |

298 | is static private; | |

299 | ||

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

301 | XYComp : Real from Standard; | |

302 | DUVComp : Real from Standard; | |

303 | Bnd1 : out Integer from Standard; | |

304 | Bnd2 : out Integer from Standard; | |

305 | DerIsNull : out Boolean from Standard) | |

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

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

308 | -- by zero equivalence. | |

309 | is static private; | |

310 | ||

311 | ||

312 | ||

313 | fields | |

314 | ||

315 | mySurface : HSurface from Adaptor3d; | |

316 | myCurve : HCurve2d from Adaptor2d; | |

317 | ||

318 | myType : CurveType from GeomAbs; | |

319 | myCirc : Circ from gp; | |

320 | myLin : Lin from gp; | |

321 | ||

322 | myFirstSurf : HSurface from Adaptor3d; | |

323 | myLastSurf : HSurface from Adaptor3d; | |

324 | ||

325 | myIntervals : HArray1OfReal from TColStd; | |

326 | myIntCont : Shape from GeomAbs; | |

327 | ||

328 | end CurveOnSurface; | |

329 | ||

330 | ||

331 | ||

332 |