b311480e |
1 | -- Created on: 1993-04-22 |
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 LeastSquare from AppCont(MultiLine as any; |
18 | LineTool as any) |
19 | ---as TheToolLine(MultiLine) |
20 | |
21 | ---Purpose: |
22 | |
23 | |
24 | uses Matrix from math, |
25 | Vector from math, |
26 | Constraint from AppParCurves, |
27 | MultiCurve from AppParCurves |
28 | |
29 | |
30 | raises NotDone from StdFail, |
31 | OutOfRange from Standard, |
32 | DimensionError from Standard |
33 | |
34 | |
35 | |
36 | is |
37 | |
38 | Create(SSP: MultiLine; U0, U1: Real; FirstCons, LastCons: Constraint; |
39 | Deg: Integer; NbPoints: Integer = 24) |
40 | ---Purpose: given a continous MultiLine, this algorithm computes |
41 | -- the approximation into Bezier curves. |
42 | -- NbPoints points are taken on the initial MultiLine for |
43 | -- minimizing the surface between the MultiLine and the |
44 | -- Bezier curves doing the approximation. |
45 | -- The first point will be the point of parameter U0 with |
46 | -- a constraint FirstCons. |
47 | -- The last point will be the point of parameter U1 with |
48 | -- a constraint LastCons. |
49 | |
50 | returns LeastSquare from AppCont |
51 | raises DimensionError from Standard; |
52 | |
53 | |
54 | |
55 | IsDone(me) |
56 | ---Purpose: returns True if all has been correctly done. |
57 | |
58 | returns Boolean |
59 | is static; |
60 | |
61 | |
62 | Value(me: in out) |
63 | ---Purpose: returns the result of the approximation, i.e. a |
64 | -- MultiCurve. |
65 | -- An exception is raised if NotDone. |
66 | ---C++: return const & |
67 | |
68 | returns MultiCurve from AppParCurves |
69 | raises NotDone from StdFail |
70 | is static; |
71 | |
72 | |
73 | NbBColumns(me; SSP: MultiLine) |
74 | ---Purpose: is internally used by the constuctor. |
75 | |
76 | returns Integer |
77 | is static protected; |
78 | |
79 | |
80 | Error(me; F: in out Real; MaxE3d, MaxE2d: in out Real) |
81 | ---Purpose: F is the sum of the square errors at each of the |
82 | -- NbPoints of the MultiLine. |
83 | -- MaxE3d is the maximum 3d value of these errors. |
84 | -- MaxE2d is the maximum 2d value of these errors. |
85 | -- An exception is raised if NotDone. |
86 | |
87 | raises NotDone from StdFail |
88 | is static; |
89 | |
90 | |
91 | |
92 | fields |
93 | |
94 | Done: Boolean; |
95 | SCU: MultiCurve from AppParCurves; |
96 | Degre: Integer; |
97 | Nbdiscret: Integer; |
98 | nbP: Integer; |
99 | nbP2d: Integer; |
100 | Points: Matrix; |
101 | Poles: Matrix; |
102 | myParam: Vector; |
103 | VB: Matrix; |
104 | |
105 | end LeastSquare from AppCont; |
106 | |