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

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

7fd59977 | 142 | |

143 | pointer CurvePtr to Curve from Adaptor3d; | |

144 | ||

145 | deferred class HCurve; | |

7fd59977 | 146 | |

147 | generic class GenHCurve; | |

7fd59977 | 148 | |

149 | deferred class Surface; | |

7fd59977 | 150 | |

151 | pointer SurfacePtr to Surface from Adaptor3d; | |

152 | ||

153 | deferred class HSurface; | |

7fd59977 | 154 | |

155 | generic class GenHSurface; | |

7fd59977 | 156 | |

157 | ||

158 | -- | |

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

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

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

162 | -- | |

163 | ||

164 | ||

165 | class HVertex; | |

166 | ||

167 | class HSurfaceTool; | |

168 | ||

169 | class TopolTool; | |

170 | ||

171 | -- | |

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

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

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

175 | -- | |

176 | -- | |

177 | ||

178 | ||

179 | class IsoCurve; | |

7fd59977 | 180 | |

181 | class HIsoCurve instantiates GenHCurve from Adaptor3d | |

182 | (IsoCurve from Adaptor3d); | |

183 | ||

184 | ||

185 | class CurveOnSurface; | |

7fd59977 | 186 | |

187 | pointer CurveOnSurfacePtr to CurveOnSurface from Adaptor3d; | |

188 | ||

189 | class HCurveOnSurface instantiates GenHCurve from Adaptor3d | |

190 | (CurveOnSurface from Adaptor3d); | |

191 | ||

192 | ||

193 | ||

194 | class OffsetCurve; | |

7fd59977 | 195 | |

ff8178ef | 196 | class HOffsetCurve instantiates GenHCurve2d from Adaptor2d |

7fd59977 | 197 | (OffsetCurve from Adaptor3d); |

ff8178ef | 198 | |

7fd59977 | 199 | class SurfaceOfRevolution; |

7fd59977 | 200 | |

201 | class HSurfaceOfRevolution instantiates GenHSurface from Adaptor3d | |

202 | (SurfaceOfRevolution from Adaptor3d); | |

203 | ||

204 | ||

205 | ||

206 | class SurfaceOfLinearExtrusion; | |

7fd59977 | 207 | |

208 | class HSurfaceOfLinearExtrusion instantiates GenHSurface from Adaptor3d | |

209 | (SurfaceOfLinearExtrusion from Adaptor3d); | |

210 | ||

211 | private class InterFunc; | |

7fd59977 | 212 | |

213 | end Adaptor3d; |