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

7fd59977 | 1 | -- File: Adaptor3d.cdl |

2 | -- Created: Thu Oct 8 10:33:07 1992 | |

3 | -- Author: Isabelle GRIGNON | |

4 | -- <isg@sdsun2> | |

5 | ---Copyright: Matra Davision 1992 | |

6 | ||

7 | ||

8 | ||

9 | ||

10 | package Adaptor3d | |

11 | ||

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

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

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

15 | -- | |

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

17 | -- | |

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

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

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

21 | -- | |

22 | -- The services are : | |

23 | -- | |

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

25 | -- | |

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

27 | -- | |

28 | -- - Continuity breakout services : | |

29 | -- | |

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

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

32 | -- | |

33 | -- - Special geometries detection services : | |

34 | -- | |

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

36 | -- be processed more easily : | |

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

38 | -- | |

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

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

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

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

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

44 | -- | |

45 | -- | |

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

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

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

49 | -- Curve2d and Surface. | |

50 | -- | |

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

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

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

54 | -- described above. | |

55 | -- | |

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

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

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

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

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

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

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

63 | -- | |

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

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

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

67 | -- written the Curve class. | |

68 | -- | |

69 | -- | |

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

71 | -- | |

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

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

74 | -- Adaptor3d : | |

75 | -- | |

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

77 | -- | |

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

79 | -- | |

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

81 | -- | |

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

83 | -- const Adaptor2d_Curve2d& C2) | |

84 | -- { | |

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

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

87 | -- | |

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

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

90 | -- | |

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

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

93 | -- | |

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

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

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

97 | -- | |

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

99 | -- | |

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

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

102 | -- | |

103 | -- | |

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

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

106 | -- | |

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

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

109 | -- space of a surface. | |

110 | -- | |

111 | -- | |

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

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

114 | -- - SurfaceOfLinearExtrusion | |

115 | -- - SurfaceOfRevolution | |

116 | -- | |

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

118 | ||

119 | uses | |

120 | Standard, | |

121 | MMgt, | |

122 | TColStd, | |

123 | GeomAbs, | |

124 | TopAbs, | |

125 | TColgp, | |

126 | gp, | |

127 | Geom2d, | |

128 | Geom, | |

129 | math, | |

130 | Adaptor2d | |

131 | ||

132 | is | |

133 | ||

134 | deferred class Curve; | |

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

136 | ||

137 | pointer CurvePtr to Curve from Adaptor3d; | |

138 | ||

139 | deferred class HCurve; | |

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

141 | -- Handle. | |

142 | ||

143 | generic class GenHCurve; | |

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

145 | -- from HCurve. | |

146 | ||

147 | ||

148 | deferred class Surface; | |

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

150 | ||

151 | pointer SurfacePtr to Surface from Adaptor3d; | |

152 | ||

153 | deferred class HSurface; | |

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

155 | -- Handle. | |

156 | ||

157 | generic class GenHSurface; | |

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

159 | -- from HSurface. | |

160 | ||

161 | ||

162 | -- | |

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

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

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

166 | -- | |

167 | ||

168 | ||

169 | class HVertex; | |

170 | ||

171 | class HSurfaceTool; | |

172 | ||

173 | class TopolTool; | |

174 | ||

175 | -- | |

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

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

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

179 | -- | |

180 | -- | |

181 | ||

182 | ||

183 | class IsoCurve; | |

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

185 | ||

186 | class HIsoCurve instantiates GenHCurve from Adaptor3d | |

187 | (IsoCurve from Adaptor3d); | |

188 | ||

189 | ||

190 | class CurveOnSurface; | |

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

192 | -- in the parameter space. | |

193 | ||

194 | pointer CurveOnSurfacePtr to CurveOnSurface from Adaptor3d; | |

195 | ||

196 | class HCurveOnSurface instantiates GenHCurve from Adaptor3d | |

197 | (CurveOnSurface from Adaptor3d); | |

198 | ||

199 | ||

200 | ||

201 | class OffsetCurve; | |

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

203 | ||

204 | class HOffsetCurve instantiates GenHCurve2d from Adaptor2d | |

205 | (OffsetCurve from Adaptor3d); | |

206 | ||

207 | ||

208 | class SurfaceOfRevolution; | |

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

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

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

212 | ||

213 | class HSurfaceOfRevolution instantiates GenHSurface from Adaptor3d | |

214 | (SurfaceOfRevolution from Adaptor3d); | |

215 | ||

216 | ||

217 | ||

218 | class SurfaceOfLinearExtrusion; | |

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

220 | ||

221 | class HSurfaceOfLinearExtrusion instantiates GenHSurface from Adaptor3d | |

222 | (SurfaceOfLinearExtrusion from Adaptor3d); | |

223 | ||

224 | private class InterFunc; | |

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

226 | -- find the roots of the functions | |

227 | ||

228 | end Adaptor3d; |