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

b311480e | 1 | -- Created on: 1992-10-08 |

2 | -- Created by: Isabelle GRIGNON | |

3 | -- Copyright (c) 1992-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 | -- |

973c2be1 | 8 | -- This library is free software; you can redistribute it and / or modify it |

9 | -- under the terms of the GNU Lesser General Public version 2.1 as published | |

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

18 | ||

19 | ---Purpose: The Adaptor3d package is used to help defining | |

20 | -- reusable geometric algorithms. i.e. that can be | |

21 | -- used on curves and surfaces. | |

22 | -- | |

23 | -- It defines general services for 3 kind of objects : | |

24 | -- | |

25 | -- - the 2d curve. Curve2d | |

26 | -- - the 3d curve. Curve | |

27 | -- - the 3d surface. Surface | |

28 | -- | |

29 | -- The services are : | |

30 | -- | |

31 | -- - Usual services found in Geom or Geom2d : | |

32 | -- | |

33 | -- * parameter range, value and derivatives, etc... | |

34 | -- | |

35 | -- - Continuity breakout services : | |

36 | -- | |

37 | -- * Allows to divide a curve or a surfaces in | |

38 | -- parts with a given derivation order. | |

39 | -- | |

40 | -- - Special geometries detection services : | |

41 | -- | |

42 | -- * Allows to test for special cases that can | |

43 | -- be processed more easily : | |

44 | -- - Conics, Quadrics, Bezier, BSpline ... | |

45 | -- | |

46 | -- And to get the correponding data form the | |

47 | -- package gp or Geom. The special type | |

48 | -- OtherCurve means that no special case has | |

49 | -- been detected and the algorithm may use | |

50 | -- only the evaluation methods (D0, D1, ...) | |

51 | -- | |

52 | -- | |

53 | -- For each category Curve2d, Curve, Surface we | |

54 | -- define three classes, we illustrate now the | |

55 | -- principles with the Curve, the same applies to | |

56 | -- Curve2d and Surface. | |

57 | -- | |

58 | -- The class Curve is the abstract root for all | |

59 | -- Curves used by algorithms, it is handled by value | |

60 | -- and provides as deferred methods the services | |

61 | -- described above. | |

62 | -- | |

63 | -- Some services (breakout) requires to create new | |

64 | -- curves, this leads to memory allocation | |

65 | -- considerations (who create the curve, who deletes | |

66 | -- it ?). To solve this problem elegantly the curve | |

67 | -- will return a HCurve, the HCurve is a curve | |

68 | -- handled by reference so it will be deallocated | |

69 | -- automatically when it is not used. | |

70 | -- | |

71 | -- A third class GenHCurve is provided, this class is | |

72 | -- generic and its utility is to provide automatic | |

73 | -- generation of the HCurve class when you have | |

74 | -- written the Curve class. | |

75 | -- | |

76 | -- | |

77 | -- * Let us show an example (with 2d curves) : | |

78 | -- | |

79 | -- Imagine an algorithm to intersect curves, this | |

80 | -- algorithms is written to process Curve2d from | |

81 | -- Adaptor3d : | |

82 | -- | |

83 | -- A method may look like : | |

84 | -- | |

85 | -- Intersect(C1,C2 : Curve2d from Adaptor3d); | |

86 | -- | |

87 | -- Which will look like in C++ | |

88 | -- | |

89 | -- Intersect(const Adaptor2d_Curve2d& C1, | |

90 | -- const Adaptor2d_Curve2d& C2) | |

91 | -- { | |

92 | -- // you can call any method | |

93 | -- Standard_Real first1 = C1.FirstParameter(); | |

94 | -- | |

95 | -- // but avoid to copy in an Adaptor3d_Curve which | |

96 | -- // is an Abstract class, use a reference or a pointer | |

97 | -- | |

98 | -- const Adaptor3d_Curve& C = C1; | |

99 | -- const Adaptor3d_Curve *pC = &C1; | |

100 | -- | |

101 | -- // If you are interseted in Intervals you must | |

102 | -- // store them in a HCurve to ensure they are kept | |

103 | -- // in memory. Then a referrence may be used. | |

104 | -- | |

105 | -- Handle(Adaptor3d_HCurve) HCI = C1.Interval(1); | |

106 | -- | |

107 | -- const Adaptor3d_Curve& CI = HCI->Curve(); | |

108 | -- pC = &(HCI->Curve()); | |

109 | -- | |

110 | -- | |

111 | -- * The Adaptor3d provides also Generic classes | |

112 | -- implementing algorithmic curves and surfaces. | |

113 | -- | |

114 | -- - IsoCurve : Isoparametric curve on a surface. | |

115 | -- - CurveOnSurface : 2D curve in the parametric | |

116 | -- space of a surface. | |

117 | -- | |

118 | -- | |

119 | -- - OffsetCurve2d : 2d offset curve | |

120 | -- - ProjectedCurve : 3d curve projected on a plane | |

121 | -- - SurfaceOfLinearExtrusion | |

122 | -- - SurfaceOfRevolution | |

123 | -- | |

124 | -- They are instantiated with HCurve, HSurface, HCurved2d | |

125 | ||

126 | uses | |

127 | Standard, | |

128 | MMgt, | |

129 | TColStd, | |

130 | GeomAbs, | |

131 | TopAbs, | |

132 | TColgp, | |

133 | gp, | |

134 | Geom2d, | |

135 | Geom, | |

136 | math, | |

137 | Adaptor2d | |

138 | ||

139 | is | |

140 | ||

141 | deferred class Curve; | |

142 | ---Purpose: Root of the 3d curve. | |

143 | ||

144 | pointer CurvePtr to Curve from Adaptor3d; | |

145 | ||

146 | deferred class HCurve; | |

147 | ---Purpose: deferred class for the curves manipulated with | |

148 | -- Handle. | |

149 | ||

150 | generic class GenHCurve; | |

151 | ---Purpose: Generic class used to create a curve inheriting | |

152 | -- from HCurve. | |

153 | ||

154 | ||

155 | deferred class Surface; | |

156 | ---Purpose: Root of the surface. | |

157 | ||

158 | pointer SurfacePtr to Surface from Adaptor3d; | |

159 | ||

160 | deferred class HSurface; | |

161 | ---Purpose: deferred class for the surfaces manipulated with | |

162 | -- Handle. | |

163 | ||

164 | generic class GenHSurface; | |

165 | ---Purpose: Generic class used to create a surface inheriting | |

166 | -- from HSurface. | |

167 | ||

168 | ||

169 | -- | |

170 | -- The following classes are used to define an abstract | |

171 | -- simplified "topology" for surfaces. This is used by | |

172 | -- algorithm as mass properties or surface intersections. | |

173 | -- | |

174 | ||

175 | ||

176 | class HVertex; | |

177 | ||

178 | class HSurfaceTool; | |

179 | ||

180 | class TopolTool; | |

181 | ||

182 | -- | |

183 | -- The following classes provides algorithmic curves and | |

184 | -- surface, they are inheriting from Curve and Surface and the | |

185 | -- correponding HCurve and HSurface is instantiated. | |

186 | -- | |

187 | -- | |

188 | ||

189 | ||

190 | class IsoCurve; | |

191 | ---Purpose: Algorithmic 3d curv, isoparametric on a surface. | |

192 | ||

193 | class HIsoCurve instantiates GenHCurve from Adaptor3d | |

194 | (IsoCurve from Adaptor3d); | |

195 | ||

196 | ||

197 | class CurveOnSurface; | |

198 | ---Purpose: Algorithmic 3d curve from a surface and a 2d curve | |

199 | -- in the parameter space. | |

200 | ||

201 | pointer CurveOnSurfacePtr to CurveOnSurface from Adaptor3d; | |

202 | ||

203 | class HCurveOnSurface instantiates GenHCurve from Adaptor3d | |

204 | (CurveOnSurface from Adaptor3d); | |

205 | ||

206 | ||

207 | ||

208 | class OffsetCurve; | |

209 | ---Purpose: Algorithmic 2d curve. | |

210 | ||

211 | class HOffsetCurve instantiates GenHCurve2d from Adaptor2d | |

212 | (OffsetCurve from Adaptor3d); | |

213 | ||

214 | ||

215 | class SurfaceOfRevolution; | |

216 | ---Purpose: Algorithmic Surface from a Curve and an Axis | |

217 | -- Curve and Axis are coplanar. | |

218 | -- Curve doesn't intersect Axis. | |

219 | ||

220 | class HSurfaceOfRevolution instantiates GenHSurface from Adaptor3d | |

221 | (SurfaceOfRevolution from Adaptor3d); | |

222 | ||

223 | ||

224 | ||

225 | class SurfaceOfLinearExtrusion; | |

226 | ---Purpose: Algorithmic Surface from a curve and a direction | |

227 | ||

228 | class HSurfaceOfLinearExtrusion instantiates GenHSurface from Adaptor3d | |

229 | (SurfaceOfLinearExtrusion from Adaptor3d); | |

230 | ||

231 | private class InterFunc; | |

232 | ---Purpose: function to find the Cn discontinuity point. Used to | |

233 | -- find the roots of the functions | |

234 | ||

235 | end Adaptor3d; |