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

b311480e | 1 | -- Created on: 1993-05-14 |

2 | -- Created by: Laurent PAINNOT | |

3 | -- Copyright (c) 1993-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 | generic class ComputeCLine from Approx | |

18 | (MultiLine as any; | |

19 | LineTool as any) --as TheLineTool from AppCont(MultiLine) | |

20 | ||

21 | ||

22 | uses ParametrizationType from Approx, | |

23 | SequenceOfReal from TColStd, | |

24 | HArray1OfReal from TColStd, | |

25 | SequenceOfMultiCurve from AppParCurves, | |

26 | MultiCurve from AppParCurves, | |

27 | Constraint from AppParCurves, | |

28 | Vector from math | |

29 | ||

30 | ||

31 | ||

32 | private class MyLeastSquare instantiates LeastSquare from AppCont | |

33 | (MultiLine, | |

34 | LineTool); | |

35 | ||

36 | is | |

37 | ||

38 | ||

39 | Create(Line: MultiLine; | |

40 | degreemin: Integer = 3; | |

41 | degreemax: Integer = 8; | |

42 | Tolerance3d: Real = 1.0e-5; | |

43 | Tolerance2d: Real = 1.0e-5; | |

44 | cutting: Boolean = Standard_False; | |

45 | FirstC: Constraint = AppParCurves_TangencyPoint; | |

46 | LastC: Constraint = AppParCurves_TangencyPoint) | |

47 | ||

48 | ---Purpose: The MultiLine <Line> will be approximated until tolerances | |

49 | -- will be reached. | |

50 | -- The approximation will be done from degreemin to degreemax | |

51 | -- with a cutting if the corresponding boolean is True. | |

52 | ||

53 | returns ComputeCLine; | |

54 | ||

55 | ||

56 | ||

57 | ||

58 | Create(degreemin: Integer = 3; | |

59 | degreemax: Integer = 8; | |

60 | Tolerance3d: Real = 1.0e-05; | |

61 | Tolerance2d: Real = 1.0e-05; | |

62 | cutting: Boolean = Standard_False; | |

63 | FirstC: Constraint = AppParCurves_TangencyPoint; | |

64 | LastC: Constraint = AppParCurves_TangencyPoint) | |

65 | ||

66 | ---Purpose: Initializes the fields of the algorithm. | |

67 | ||

68 | returns ComputeCLine; | |

69 | ||

70 | ||

71 | Perform(me: in out; Line: MultiLine) | |

72 | ---Purpose: runs the algorithm after having initialized the fields. | |

73 | ||

74 | is static; | |

75 | ||

76 | ||

77 | Compute(me: in out; Line: MultiLine; Ufirst, Ulast: Real; | |

78 | TheTol3d, TheTol2d: in out Real) | |

79 | ---Purpose: is internally used by the algorithms. | |

80 | ||

81 | returns Boolean | |

82 | is static private; | |

83 | ||

84 | ||

85 | SetDegrees(me: in out; degreemin, degreemax: Integer) | |

86 | ---Purpose: changes the degrees of the approximation. | |

87 | ||

88 | is static; | |

89 | ||

90 | ||

91 | SetTolerances(me: in out; Tolerance3d, Tolerance2d: Real) | |

92 | ---Purpose: Changes the tolerances of the approximation. | |

93 | ||

94 | is static; | |

95 | ||

96 | ||

97 | SetConstraints(me: in out; FirstC, LastC: Constraint) | |

98 | ---Purpose: Changes the constraints of the approximation. | |

99 | ||

100 | is static; | |

101 | ||

102 | ||

103 | IsAllApproximated(me) | |

104 | ---Purpose: returns False if at a moment of the approximation, | |

105 | -- the status NoApproximation has been sent by the user | |

106 | -- when more points were needed. | |

107 | ||

108 | returns Boolean | |

109 | is static; | |

110 | ||

111 | IsToleranceReached(me) | |

112 | ---Purpose: returns False if the status NoPointsAdded has been sent. | |

113 | ||

114 | returns Boolean | |

115 | is static; | |

116 | ||

117 | ||

118 | Error(me; Index: Integer; tol3d: in out Real; tol2d: in out Real) | |

119 | ---Purpose: returns the tolerances 2d and 3d of the <Index> MultiCurve. | |

120 | ||

121 | is static; | |

122 | ||

123 | ||

124 | NbMultiCurves(me) | |

125 | ---Purpose: Returns the number of MultiCurve doing the approximation | |

126 | -- of the MultiLine. | |

127 | returns Integer | |

128 | is static; | |

129 | ||

130 | ||

131 | Value(me; Index: Integer = 1) | |

132 | ---Purpose: returns the approximation MultiCurve of range <Index>. | |

133 | ||

134 | returns MultiCurve from AppParCurves; | |

135 | ||

136 | ||

137 | Parameters(me; Index: Integer; firstp, lastp: in out Real) | |

138 | ---purpose: returns the first and last parameters of the | |

139 | -- <Index> MultiCurve. | |

140 | is static; | |

141 | ||

142 | ||

143 | fields | |

144 | ||

145 | ||

146 | myMultiCurves: SequenceOfMultiCurve from AppParCurves; | |

147 | myfirstparam: SequenceOfReal from TColStd; | |

148 | mylastparam: SequenceOfReal from TColStd; | |

149 | TheMultiCurve: MultiCurve from AppParCurves; | |

150 | alldone: Boolean; | |

151 | tolreached: Boolean; | |

152 | Tolers3d: SequenceOfReal from TColStd; | |

153 | Tolers2d: SequenceOfReal from TColStd; | |

154 | mydegremin: Integer; | |

155 | mydegremax: Integer; | |

156 | mytol3d: Real; | |

157 | mytol2d: Real; | |

158 | currenttol3d: Real; | |

159 | currenttol2d: Real; | |

160 | mycut: Boolean; | |

161 | myfirstC: Constraint; | |

162 | mylastC: Constraint; | |

163 | ||

164 | ||

165 | end ComputeCLine; |