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

b311480e | 1 | -- Created on: 1993-03-31 |

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 | deferred class Curve from Adaptor3d | |

18 | ||

19 | ---Purpose: Root class for 3D curves on which geometric | |

20 | -- algorithms work. | |

21 | -- An adapted curve is an interface between the | |

22 | -- services provided by a curve and those required of | |

23 | -- the curve by algorithms which use it. | |

24 | -- Two derived concrete classes are provided: | |

25 | -- - GeomAdaptor_Curve for a curve from the Geom package | |

26 | -- - Adaptor3d_CurveOnSurface for a curve lying on | |

27 | -- a surface from the Geom package. | |

28 | ||

29 | ||

30 | uses | |

31 | Array1OfReal from TColStd, | |

32 | Shape from GeomAbs, | |

33 | CurveType from GeomAbs, | |

34 | Vec from gp, | |

35 | Pnt from gp, | |

36 | Circ from gp, | |

37 | Elips from gp, | |

38 | Hypr from gp, | |

39 | Parab from gp, | |

40 | Lin from gp, | |

41 | BezierCurve from Geom, | |

42 | BSplineCurve from Geom, | |

43 | HCurve from Adaptor3d | |

44 | ||

45 | raises | |

46 | ||

47 | OutOfRange from Standard, | |

48 | NoSuchObject from Standard, | |

49 | DomainError from Standard | |

50 | ||

51 | is | |

52 | ||

53 | -- | |

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

55 | -- | |

56 | ||

57 | Delete(me:out) is virtual; | |

58 | ---C++: alias "Standard_EXPORT virtual ~Adaptor3d_Curve(){Delete();}" | |

59 | ||

60 | FirstParameter(me) returns Real | |

61 | is virtual; | |

62 | ||

63 | LastParameter(me) returns Real | |

64 | is virtual; | |

65 | ||

66 | -- | |

67 | -- Services to break the curves to the expected continuity | |

68 | -- | |

69 | -- If for example you need the curve to be C2 and the method | |

70 | -- Continuity returns you something lower than C2 (say C1 for | |

71 | -- example). | |

72 | -- | |

73 | -- First compute the number of intervals with the requested | |

74 | -- continuity with the method NbIntervals(). Note that if the | |

75 | -- continuity is higher than the one you need NbIntervals will | |

76 | -- return 1. | |

77 | -- | |

78 | -- Then you get the parameters bounding the intervals with the | |

79 | -- method Intervals, using an array of length at least | |

80 | -- NbIntervals()+1. | |

81 | -- | |

82 | -- If you need to create a curve with a restricted span you can | |

83 | -- use the method Trim(). | |

84 | ||

85 | ||

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

87 | ---Purpose: | |

88 | is virtual; | |

89 | ||

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

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

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

93 | is virtual; | |

94 | ||

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

96 | S : Shape from GeomAbs) | |

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

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

99 | -- | |

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

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

102 | raises | |

103 | OutOfRange from Standard | |

104 | is virtual; | |

105 | ||

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

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

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

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

110 | raises | |

111 | OutOfRange from Standard | |

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

113 | is virtual; | |

114 | ||

115 | ||

116 | IsClosed(me) returns Boolean | |

117 | is virtual; | |

118 | ||

119 | IsPeriodic(me) returns Boolean | |

120 | is virtual; | |

121 | ||

122 | Period(me) returns Real | |

123 | raises | |

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

125 | is virtual; | |

126 | ||

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

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

129 | is virtual; | |

130 | ||

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

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

133 | is virtual; | |

134 | ||

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

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

137 | -- first derivative. | |

138 | raises | |

139 | DomainError from Standard | |

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

141 | -- is not C1. | |

142 | is virtual; | |

143 | ||

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

145 | --- Purpose : | |

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

147 | -- derivatives V1 and V2. | |

148 | raises | |

149 | DomainError from Standard | |

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

151 | -- is not C2. | |

152 | is virtual; | |

153 | ||

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

155 | --- Purpose : | |

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

157 | -- and the third derivative. | |

158 | raises | |

159 | DomainError from Standard | |

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

161 | -- is not C3. | |

162 | is virtual; | |

163 | ||

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

165 | --- Purpose : | |

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

167 | -- order of derivation N. | |

168 | raises | |

169 | DomainError from Standard, | |

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

171 | -- is not CN. | |

172 | OutOfRange from Standard | |

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

174 | is virtual; | |

175 | ||

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

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

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

179 | is virtual; | |

180 | ||

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

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

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

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

185 | is virtual; | |

186 | ||

187 | -- | |

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

189 | -- the corresponding type. | |

190 | -- | |

191 | ||

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

193 | raises | |

194 | NoSuchObject from Standard | |

195 | is virtual; | |

196 | ||

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

198 | raises | |

199 | NoSuchObject from Standard | |

200 | is virtual; | |

201 | ||

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

203 | raises | |

204 | NoSuchObject from Standard | |

205 | is virtual; | |

206 | ||

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

208 | raises | |

209 | NoSuchObject from Standard | |

210 | is virtual; | |

211 | ||

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

213 | raises | |

214 | NoSuchObject from Standard | |

215 | is virtual; | |

216 | ||

217 | ||

218 | Degree(me) returns Integer | |

219 | raises | |

220 | NoSuchObject from Standard | |

221 | is virtual; | |

222 | ||

223 | IsRational(me) returns Boolean | |

224 | raises | |

225 | NoSuchObject from Standard | |

226 | is virtual; | |

227 | ||

228 | NbPoles(me) returns Integer | |

229 | raises | |

230 | NoSuchObject from Standard | |

231 | is virtual; | |

232 | ||

233 | ||

234 | NbKnots(me) returns Integer | |

235 | raises | |

236 | NoSuchObject from Standard | |

237 | is virtual; | |

238 | ||

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

240 | raises | |

241 | NoSuchObject from Standard | |

242 | is virtual; | |

243 | ||

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

245 | raises | |

246 | NoSuchObject from Standard | |

247 | is virtual; | |

248 | ||

249 | end Curve; | |

250 | ||

251 |