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

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

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

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 | generic class SurfLeastSquare from AppCont(Surface as any; | |

18 | SurfTool as any) | |

19 | ---as TheSurfTool(Surface) | |

20 | ||

21 | ---Purpose: | |

22 | ||

23 | ||

24 | uses Matrix from math, | |

25 | Vector from math, | |

26 | Constraint from AppParCurves, | |

27 | MultiCurve from AppParCurves, | |

28 | BezierSurface from Geom | |

29 | ||

30 | ||

31 | raises NotDone from StdFail, | |

32 | OutOfRange from Standard, | |

33 | DimensionError from Standard | |

34 | ||

35 | ||

36 | ||

37 | is | |

38 | ||

39 | Create(Surf: Surface; U0, U1, V0, V1: Real; | |

40 | FirstCons, LastUCons, LastVCons, LastCons: Constraint; | |

41 | DegU, DegV: Integer; NbPoints: Integer = 12) | |

42 | ---Purpose: given a MultiLine, this algorithm computes the | |

43 | -- approximation of a continous Surface into a bezier | |

44 | -- Surface. | |

45 | -- The algorithm minimizes the volume between the | |

46 | -- Surface Surf and the Bezier Surface doing the | |

47 | -- aproximation. | |

48 | -- NbPoints * NbPoints are taken on the Surface Surf. | |

49 | -- The Constraints are affected to the following points: | |

50 | -- | |

51 | -- U0, V0 |--|---|---|---|---|---|-----| U1, V0 | |

52 | -- FirstCons | | | | | | | LastUCons | |

53 | -- |--|---|---|---|---|---|-----| | |

54 | -- |--|---|---|---|---|---|-----| | |

55 | -- | | | | | | | | | |

56 | -- U0, V1 |--|---|---|---|---|---|-----| U1, V1 | |

57 | -- LastVCons LastCons | |

58 | ||

59 | ||

60 | returns SurfLeastSquare from AppCont | |

61 | raises DimensionError from Standard; | |

62 | ||

63 | ||

64 | ||

65 | IsDone(me) | |

66 | ---Purpose: returns True if all has been correctly done. | |

67 | ||

68 | returns Boolean | |

69 | is static; | |

70 | ||

71 | ||

72 | Value(me: in out) | |

73 | ---Purpose: returns the result of the approximation. | |

74 | -- An exception is raised if NotDone. | |

75 | ---C++: return const & | |

76 | ||

77 | returns BezierSurface from Geom | |

78 | raises NotDone from StdFail | |

79 | is static; | |

80 | ||

81 | ||

82 | ||

83 | Error(me; F: in out Real; MaxE3d: in out Real) | |

84 | ---Purpose: F is the sum of the square errors at each of the | |

85 | -- NbPoints*NbPoints and MaxE3d is the maximum value | |

86 | -- of these errors. | |

87 | -- An exception is raised if NotDone. | |

88 | ||

89 | raises NotDone from StdFail | |

90 | is static; | |

91 | ||

92 | ||

93 | ||

94 | fields | |

95 | ||

96 | Done: Boolean; | |

97 | SCU: BezierSurface from Geom; | |

98 | DegreU: Integer; | |

99 | DegreV: Integer; | |

100 | Nbdiscret: Integer; | |

101 | nbP: Integer; | |

102 | PointsX: Matrix; | |

103 | PointsY: Matrix; | |

104 | PointsZ: Matrix; | |

105 | PolesX: Vector; | |

106 | PolesY: Vector; | |

107 | PolesZ: Vector; | |

108 | myUParam: Vector; | |

109 | myVParam: Vector; | |

110 | VBU: Matrix; | |

111 | VBV: Matrix; | |

112 | ||

113 | end SurfLeastSquare from AppCont; | |

114 |