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

b311480e | 1 | -- Created on: 1996-08-22 |

2 | -- Created by: Stagiaire Mary FABIEN | |

3 | -- Copyright (c) 1996-1999 Matra Datavision | |

4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS | |

5 | -- | |

6 | -- The content of this file is subject to the Open CASCADE Technology Public | |

7 | -- License Version 6.5 (the "License"). You may not use the content of this file | |

8 | -- except in compliance with the License. Please obtain a copy of the License | |

9 | -- at http://www.opencascade.org and read it completely before using this file. | |

10 | -- | |

11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its | |

12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. | |

13 | -- | |

14 | -- The Original Code and all software distributed under the License is | |

15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the | |

16 | -- Initial Developer hereby disclaims all such warranties, including without | |

17 | -- limitation, any warranties of merchantability, fitness for a particular | |

18 | -- purpose or non-infringement. Please see the License for the specific terms | |

19 | -- and conditions governing the rights and limitations under the License. | |

20 | ||

7fd59977 | 21 | |

22 | class QuasiUniformAbscissa from GCPnts | |

23 | ||

24 | ||

25 | ---Purpose: This class provides an algorithm to compute a uniform abscissa | |

26 | -- distribution of points on a curve, i.e. a sequence of | |

27 | -- equidistant points. The distance between two | |

28 | -- consecutive points is measured along the curve. | |

29 | -- The distribution is defined: | |

30 | -- - either by the curvilinear distance between two consecutive points | |

31 | -- - or by a number of points. | |

32 | uses | |

33 | Curve from Adaptor3d, | |

34 | Curve2d from Adaptor2d, | |

35 | HArray1OfReal from TColStd | |

36 | ||

37 | ||

38 | raises DomainError from Standard, | |

39 | ConstructionError from Standard, | |

40 | OutOfRange from Standard, | |

41 | NotDone from StdFail | |

42 | ||

43 | is | |

44 | ||

45 | Create | |

46 | ---Purpose: Constructs an empty algorithm. To define the problem | |

47 | -- to be solved, use the function Initialize. | |

48 | returns QuasiUniformAbscissa from GCPnts; | |

49 | ||

50 | Create(C : in out Curve from Adaptor3d ; NbPoints : Integer) | |

51 | --- Purpose : Computes a uniform abscissa distribution of points | |

52 | -- - on the curve C where Abscissa is the curvilinear distance between | |

53 | -- two consecutive points of the distribution. | |

54 | returns QuasiUniformAbscissa from GCPnts | |

55 | raises ConstructionError, | |

56 | DomainError; | |

57 | ||

58 | Create(C : in out Curve from Adaptor3d ; NbPoints : Integer; U1, U2 : Real) | |

59 | --- Purpose : Computes a uniform abscissa distribution of points | |

60 | -- on the part of curve C limited by the two parameter values U1 and U2, | |

61 | -- where Abscissa is the curvilinear distance between | |

62 | -- two consecutive points of the distribution. | |

63 | -- The first point of the distribution is either the origin of | |

64 | -- curve C or the point of parameter U1. The following | |

65 | -- points are computed such that the curvilinear | |

66 | -- distance between two consecutive points is equal to Abscissa. | |

67 | -- The last point of the distribution is either the end | |

68 | -- point of curve C or the point of parameter U2. | |

69 | -- However the curvilinear distance between this last | |

70 | -- point and the point just preceding it in the distribution | |

71 | -- is, of course, generally not equal to Abscissa. | |

72 | -- Use the function IsDone to verify that the | |

73 | -- computation was successful, the function NbPoints | |

74 | -- to obtain the number of points of the computed | |

75 | -- distribution, and the function Parameter to read the | |

76 | -- parameter of each point. | |

77 | -- Warning | |

78 | -- The roles of U1 and U2 are inverted if U1 > U2 . | |

79 | -- Warning | |

80 | -- C is an adapted curve, that is, an object which is an | |

81 | -- interface between: | |

82 | -- - the services provided by either a 2D curve from | |

83 | -- the package Geom2d (in the case of an | |

84 | -- Adaptor2d_Curve2d curve) or a 3D curve from | |

85 | -- the package Geom (in the case of an Adaptor3d_Curve curve), | |

86 | -- - and those required on the curve by the computation algorithm. | |

87 | returns QuasiUniformAbscissa from GCPnts | |

88 | raises ConstructionError, | |

89 | DomainError; | |

90 | ||

91 | ||

92 | Initialize(me : in out; C : in out Curve from Adaptor3d ; NbPoints : Integer) | |

93 | ---Purpose: Initialize the algoritms with <C>, <NbPoints> and | |

94 | raises ConstructionError | |

95 | is static; | |

96 | ||

97 | ||

98 | Initialize(me : in out; C : in out Curve from Adaptor3d ; NbPoints : Integer; U1, U2 : Real) | |

99 | ---Purpose: Initialize the algoritms with <C>, <Abscissa>, <U1>, | |

100 | -- <U2>. | |

101 | raises ConstructionError, | |

102 | DomainError | |

103 | is static; | |

104 | ||

105 | Create(C : in out Curve2d from Adaptor2d ; NbPoints : Integer) | |

106 | --- Purpose : Computes a uniform abscissa distribution of points on | |

107 | -- the Curve2d <C>. | |

108 | -- <NbPoints> defines the nomber of desired points. | |

109 | returns QuasiUniformAbscissa from GCPnts | |

110 | raises ConstructionError, | |

111 | DomainError; | |

112 | ||

113 | Create(C : in out Curve2d from Adaptor2d ; NbPoints : Integer; U1, U2 : Real) | |

114 | --- Purpose : Computes a Uniform abscissa distribution of points | |

115 | -- on a part of the Curve2d <C>. | |

116 | returns QuasiUniformAbscissa from GCPnts | |

117 | raises ConstructionError, | |

118 | DomainError; | |

119 | ||

120 | Initialize(me : in out; C : in out Curve2d from Adaptor2d ; NbPoints : Integer) | |

121 | ---Purpose: Initialize the algoritms with <C>, <NbPoints> and | |

122 | raises ConstructionError | |

123 | is static; | |

124 | ||

125 | ||

126 | Initialize(me : in out; C : in out Curve2d from Adaptor2d ; NbPoints : Integer; U1, U2 : Real) | |

127 | ---Purpose: Initialize the algoritms with <C>, <Abscissa>, <U1>, | |

128 | -- <U2>. | |

129 | raises ConstructionError, | |

130 | DomainError | |

131 | is static; | |

132 | ||

133 | ||

134 | IsDone(me) returns Boolean | |

135 | ---C++: inline | |

136 | ---Purpose: Returns true if the computation was successful. | |

137 | -- IsDone is a protection against: | |

138 | -- - non-convergence of the algorithm | |

139 | -- - querying the results before computation. | |

140 | is static; | |

141 | ||

142 | ||

143 | NbPoints(me) returns Integer | |

144 | ---C++: inline | |

145 | ---Purpose: | |

146 | -- Returns the number of points of the distribution | |

147 | -- computed by this algorithm. | |

148 | -- This value is either: | |

149 | -- - the one imposed on the algorithm at the time of | |

150 | -- construction (or initialization), or | |

151 | -- - the one computed by the algorithm when the | |

152 | -- curvilinear distance between two consecutive | |

153 | -- points of the distribution is imposed on the | |

154 | -- algorithm at the time of construction (or initialization). | |

155 | -- Exceptions | |

156 | -- StdFail_NotDone if this algorithm has not been | |

157 | -- initialized, or if the computation was not successful. | |

158 | is static; | |

159 | ||

160 | Parameter(me; Index : Integer) returns Real | |

161 | ---C++: inline | |

162 | ---Purpose : Returns the parameter of the point of index Index in | |

163 | -- the distribution computed by this algorithm. | |

164 | -- Warning | |

165 | -- Index must be greater than or equal to 1, and less | |

166 | -- than or equal to the number of points of the | |

167 | -- distribution. However, pay particular attention as this | |

168 | -- condition is not checked by this function. | |

169 | -- Exceptions | |

170 | -- StdFail_NotDone if this algorithm has not been | |

171 | -- initialized, or if the computation was not successful. | |

172 | is static; | |

173 | ||

174 | fields | |

175 | ||

176 | myDone : Boolean; | |

177 | myNbPoints : Integer ; | |

178 | -- stores the number of points computed with the | |

179 | -- requested Abscissa else stores the requested | |

180 | -- number of points | |

7fd59977 | 181 | myParams : HArray1OfReal from TColStd ; |

182 | -- the size of this array will be be bigger than myNbPoints | |

183 | -- by one or two | |

184 | ||

185 | end QuasiUniformAbscissa; |