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

b311480e | 1 | -- Created on: 1994-09-02 |

2 | -- Created by: Bruno DUMORTIER | |

3 | -- Copyright (c) 1994-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 ProjectOnPlane from ProjLib inherits Curve from Adaptor3d | |

18 | ||

19 | ||

20 | ---Purpose: Class used to project a 3d curve on a plane. The | |

21 | -- result will be a 3d curve. | |

22 | -- | |

23 | -- You can ask the projected curve to have the same | |

24 | -- parametrization as the original curve. | |

25 | -- | |

26 | -- The projection can be done along every direction not | |

27 | -- parallel to the plane. | |

28 | -- | |

29 | ||

30 | ||

31 | ||

32 | uses | |

33 | ||

34 | Shape from GeomAbs, | |

35 | CurveType from GeomAbs, | |

36 | Dir from gp, | |

37 | Ax3 from gp, | |

38 | Vec from gp, | |

39 | Pnt from gp, | |

40 | Circ from gp, | |

41 | Elips from gp, | |

42 | Hypr from gp, | |

43 | Parab from gp, | |

44 | Lin from gp, | |

45 | Curve from Adaptor3d, | |

46 | HCurve from GeomAdaptor, | |

47 | HCurve from Adaptor3d, | |

48 | BezierCurve from Geom, | |

49 | BSplineCurve from Geom, | |

50 | Array1OfPnt from TColgp, | |

51 | Array1OfReal from TColStd, | |

52 | Array1OfInteger from TColStd | |

53 | ||

54 | raises | |

55 | ||

56 | OutOfRange from Standard, | |

57 | NoSuchObject from Standard, | |

58 | DomainError from Standard, | |

59 | ConstructionError from Standard, | |

60 | NotImplemented from Standard | |

61 | ||

62 | is | |

63 | ||

64 | Create returns ProjectOnPlane from ProjLib; | |

65 | ---Purpose: Empty constructor. | |

66 | ||

67 | ||

68 | Create( Pl : Ax3 from gp) | |

69 | ---Purpose: The projection will be normal to the Plane defined | |

70 | -- by the Ax3 <Pl>. | |

71 | returns ProjectOnPlane from ProjLib; | |

72 | ||

73 | ||

74 | Create( Pl : Ax3 from gp; | |

75 | D : Dir from gp ) | |

76 | returns ProjectOnPlane from ProjLib | |

77 | ---Purpose: The projection will be along the direction <D> on | |

78 | -- the plane defined by the Ax3 <Pl>. | |

79 | raises | |

80 | ConstructionError from Standard; | |

81 | ---Purpose: raises if the direction <D> is parallel to the | |

82 | -- plane <Pl>. | |

83 | ||

84 | ||

85 | Load(me : in out; | |

86 | C : HCurve from Adaptor3d; | |

87 | Tolerance : Real from Standard; | |

88 | KeepParametrization : Boolean from Standard = Standard_True) | |

89 | ---Purpose: Sets the Curve and perform the projection. if | |

90 | -- <KeepParametrization> is true, the parametrization | |

91 | -- of the Projected Curve <PC> will be the same as | |

92 | -- the parametrization of the initial curve <C>. It | |

93 | -- meens: proj(C(u)) = PC(u) for each u. Otherwize, | |

94 | -- the parametrization may change. | |

95 | is static; | |

96 | ||

97 | ||

98 | GetPlane(me) returns Ax3 from gp | |

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

100 | is static; | |

101 | ||

102 | GetDirection (me) returns Dir from gp | |

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

104 | is static; | |

105 | ||

106 | GetCurve(me) returns HCurve from Adaptor3d | |

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

108 | is static; | |

109 | ||

110 | -- | |

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

112 | -- | |

113 | ||

114 | FirstParameter(me) returns Real | |

115 | is redefined static; | |

116 | ||

117 | LastParameter(me) returns Real | |

118 | is redefined static; | |

119 | ||

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

121 | is redefined static; | |

122 | ||

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

7fd59977 | 124 | ---Purpose: If necessary, breaks the curve in intervals of |

125 | -- continuity <S>. And returns the number of | |

126 | -- intervals. | |

127 | is redefined static; | |

128 | ||

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

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

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

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

133 | -- | |

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

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

136 | raises | |

137 | OutOfRange from Standard | |

138 | is redefined static; | |

139 | ||

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

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

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

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

144 | raises | |

145 | OutOfRange from Standard | |

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

147 | is redefined static; | |

148 | ||

149 | ||

150 | IsClosed(me) returns Boolean | |

151 | is redefined static; | |

152 | ||

153 | IsPeriodic(me) returns Boolean | |

154 | is redefined static; | |

155 | ||

156 | Period(me) returns Real | |

157 | raises | |

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

159 | is redefined static; | |

160 | ||

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

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

163 | is redefined static; | |

164 | ||

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

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

167 | is redefined static; | |

168 | ||

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

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

171 | -- first derivative. | |

172 | raises | |

173 | DomainError from Standard | |

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

175 | -- is not C1. | |

176 | is redefined static; | |

177 | ||

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

179 | --- Purpose : | |

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

181 | -- derivatives V1 and V2. | |

182 | raises | |

183 | DomainError from Standard | |

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

185 | -- is not C2. | |

186 | is redefined static; | |

187 | ||

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

189 | --- Purpose : | |

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

191 | -- and the third derivative. | |

192 | raises | |

193 | DomainError from Standard | |

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

195 | -- is not C3. | |

196 | is redefined static; | |

197 | ||

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

199 | --- Purpose : | |

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

201 | -- order of derivation N. | |

202 | raises | |

203 | DomainError from Standard, | |

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

205 | -- is not CN. | |

206 | OutOfRange from Standard | |

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

208 | is redefined static; | |

209 | ||

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

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

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

213 | is redefined static; | |

214 | ||

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

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

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

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

219 | is redefined static; | |

220 | ||

221 | -- | |

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

223 | -- the corresponding type. | |

224 | -- | |

225 | ||

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

227 | raises | |

228 | NoSuchObject from Standard | |

229 | is redefined static; | |

230 | ||

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

232 | raises | |

233 | NoSuchObject from Standard | |

234 | is redefined static; | |

235 | ||

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

237 | raises | |

238 | NoSuchObject from Standard | |

239 | is redefined static; | |

240 | ||

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

242 | raises | |

243 | NoSuchObject from Standard | |

244 | is redefined static; | |

245 | ||

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

247 | raises | |

248 | NoSuchObject from Standard | |

249 | is redefined static; | |

250 | ||

251 | ||

252 | Degree(me) returns Integer | |

253 | raises | |

254 | NoSuchObject from Standard | |

255 | is redefined static; | |

256 | ||

257 | IsRational(me) returns Boolean | |

258 | raises | |

259 | NoSuchObject from Standard | |

260 | is redefined static; | |

261 | ||

262 | NbPoles(me) returns Integer | |

263 | raises | |

264 | NoSuchObject from Standard | |

265 | is redefined static; | |

266 | ||

267 | ||

268 | NbKnots(me) returns Integer | |

269 | raises | |

270 | NoSuchObject from Standard | |

271 | is redefined static; | |

272 | ||

273 | ||

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

275 | raises | |

276 | NoSuchObject from Standard | |

277 | is redefined static; | |

278 | ---Purpose: Warning ! this will NOT make a copy of the | |

279 | -- Bezier Curve : If you want to modify | |

280 | -- the Curve please make a copy yourself | |

281 | -- Also it will NOT trim the surface to | |

282 | -- myFirst/Last. | |

283 | ||

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

285 | raises | |

286 | NoSuchObject from Standard | |

287 | is redefined static; | |

288 | ---Purpose: Warning ! this will NOT make a copy of the | |

289 | -- BSpline Curve : If you want to modify | |

290 | -- the Curve please make a copy yourself | |

291 | -- Also it will NOT trim the surface to | |

292 | -- myFirst/Last. | |

293 | ||

294 | ||

295 | fields | |

296 | ||

297 | myCurve : HCurve from Adaptor3d ; | |

298 | myPlane : Ax3 from gp; | |

299 | myDirection : Dir from gp; | |

300 | myKeepParam : Boolean from Standard; | |

301 | myFirstPar : Real from Standard; | |

302 | myLastPar : Real from Standard; | |

303 | myTolerance : Real from Standard; | |

304 | -- the tolerance to make the approximation if | |

305 | -- necessary | |

306 | myType : CurveType from GeomAbs; | |

307 | myResult : HCurve from GeomAdaptor ; | |

308 | myIsApprox : Boolean from Standard; | |

309 | ||

310 | -- the result of the approximation | |

311 | ||

312 | end ProjectOnPlane; |