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

18 | ||

19 | ---Purpose: The Adaptor2d 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 objects : | |

24 | -- | |

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

26 | -- | |

27 | -- The services are : | |

28 | -- | |

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

30 | -- | |

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

32 | -- | |

33 | -- - Continuity breakout services : | |

34 | -- | |

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

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

37 | -- | |

38 | -- - Special geometries detection services : | |

39 | -- | |

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

41 | -- be processed more easily : | |

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

43 | -- | |

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

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

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

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

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

49 | -- | |

50 | -- | |

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

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

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

54 | -- Curve2d and Surface. | |

55 | -- | |

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

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

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

59 | -- described above. | |

60 | -- | |

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

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

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

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

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

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

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

68 | -- | |

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

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

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

72 | -- written the Curve class. | |

73 | -- | |

74 | -- | |

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

76 | -- | |

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

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

79 | -- Adaptor2d : | |

80 | -- | |

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

82 | -- | |

83 | -- Intersect(C1,C2 : Curve2d from Adaptor2d); | |

84 | -- | |

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

86 | -- | |

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

88 | -- const Adaptor2d_Curve2d& C2) | |

89 | -- { | |

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

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

92 | -- | |

93 | -- // but avoid to copy in an Adaptor2d_Curve which | |

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

95 | -- | |

96 | -- const Adaptor2d_Curve& C = C1; | |

97 | -- const Adaptor2d_Curve *pC = &C1; | |

98 | -- | |

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

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

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

102 | -- | |

103 | -- Handle(Adaptor2d_HCurve) HCI = C1.Interval(1); | |

104 | -- | |

105 | -- const Adaptor2d_Curve& CI = HCI->Curve(); | |

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

107 | -- | |

108 | -- | |

109 | -- * The Adaptor2d provides also Generic classes | |

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

111 | -- | |

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

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

114 | -- space of a surface. | |

115 | -- | |

116 | -- | |

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

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

119 | -- - SurfaceOfLinearExtrusion | |

120 | -- - SurfaceOfRevolution | |

121 | -- | |

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

123 | ||

124 | uses | |

125 | Standard, | |

126 | MMgt, | |

127 | TColStd, | |

128 | GeomAbs, | |

7fd59977 | 129 | TColgp, |

130 | gp, | |

131 | Geom2d, | |

132 | math | |

133 | ||

134 | is | |

135 | ||

136 | deferred class Curve2d; | |

7fd59977 | 137 | |

138 | pointer Curve2dPtr to Curve2d from Adaptor2d; | |

139 | ||

140 | deferred class HCurve2d; | |

7fd59977 | 141 | |

142 | generic class GenHCurve2d; | |

ff8178ef | 143 | |

7fd59977 | 144 | |

145 | ||

146 | ||

147 | -- | |

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

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

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

151 | -- | |

152 | ||

153 | ||

154 | class Line2d; | |

155 | ||

156 | class HLine2d instantiates GenHCurve2d(Line2d from Adaptor2d); | |

157 | ---Purpose: Use by the TopolTool to trim a surface. | |

158 | ||

159 | -- | |

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

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

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

163 | -- | |

164 | -- | |

165 | ||

166 | ||

167 | ||

168 | end Adaptor2d; |