7fd59977 |
1 | -- File: AppParCurves_Projection.cdl |
2 | -- Created: Thu Jun 24 16:27:02 1993 |
3 | -- Author: Modelistation |
4 | -- <model@nonox> |
5 | ---Copyright: Matra Datavision 1993 |
6 | |
7 | |
8 | generic class Projection from AppParCurves |
9 | (MultiLine as any; |
10 | ToolLine as any) -- as ToolLine(MultiLine) |
11 | |
12 | |
13 | ---Purpose: This algorithm uses the algorithms LeastSquare, |
14 | -- ResConstraint and a Projection method to approximate a set |
15 | -- of points (AppDef_MultiLine) with a minimization of the |
16 | -- sum(square(|F(i)-Qi|)) by changing the parameter. |
17 | |
18 | |
19 | |
20 | uses Vector from math, |
21 | MultiCurve from AppParCurves, |
22 | HArray1OfConstraintCouple from AppParCurves |
23 | |
24 | |
25 | raises OutOfRange from Standard, |
26 | NotDone from StdFail |
27 | |
28 | |
29 | private class ProLeastSquare instantiates LeastSquare from AppParCurves |
30 | (MultiLine, ToolLine); |
31 | |
32 | private class ProConstraint instantiates ResolConstraint from AppParCurves |
33 | (MultiLine, ToolLine); |
34 | |
35 | private class ProFunction instantiates Function from AppParCurves |
36 | (MultiLine, ToolLine, ProLeastSquare, ProConstraint); |
37 | |
38 | |
39 | is |
40 | |
41 | Create(SSP: MultiLine; FirstPoint, LastPoint: Integer; |
42 | TheConstraints: HArray1OfConstraintCouple; |
43 | Parameters: in out Vector; Deg: Integer; |
44 | Tol3d, Tol2d: Real; NbIterations: Integer = 200) |
45 | ---Purpose: Tries to minimize the sum (square(||Qui - Bi*Pi||)) |
46 | -- where Pui describe the approximating Bezier curves'Poles |
47 | -- and Qi the MultiLine points with a parameter ui. |
48 | -- In this algorithm, the parameters ui are the unknowns. |
49 | -- The tolerance required on this sum is given by Tol. |
50 | -- The desired degree of the resulting curve is Deg. |
51 | -- SSP is returned with the new parameter. |
52 | |
53 | returns Projection from AppParCurves; |
54 | |
55 | |
56 | IsDone(me) |
57 | ---Purpose: returns True if all has been correctly done. |
58 | |
59 | returns Boolean |
60 | is static; |
61 | |
62 | |
63 | Value(me) |
64 | ---Purpose: returns all the Bezier curves approximating the |
65 | -- MultiLine SSP after minimization of the parameter. |
66 | |
67 | returns MultiCurve from AppParCurves |
68 | raises NotDone from StdFail |
69 | is static; |
70 | |
71 | |
72 | Error(me; Index: Integer) |
73 | ---Purpose: returns the difference between the old and the new |
74 | -- approximation. |
75 | -- An exception is raised if NotDone. |
76 | -- An exception is raised if Index<1 or Index>NbParameters. |
77 | |
78 | returns Real |
79 | raises NotDone from StdFail, |
80 | OutOfRange from Standard |
81 | is static; |
82 | |
83 | |
84 | MaxError3d(me) |
85 | ---Purpose: returns the maximum difference between the old and the |
86 | -- new approximation. |
87 | |
88 | returns Real |
89 | raises NotDone from StdFail |
90 | is static; |
91 | |
92 | |
93 | MaxError2d(me) |
94 | ---Purpose: returns the maximum difference between the old and the |
95 | -- new approximation. |
96 | |
97 | returns Real |
98 | raises NotDone from StdFail |
99 | is static; |
100 | |
101 | |
102 | AverageError(me) |
103 | ---Purpose: returns the average error between the old and the |
104 | -- new approximation. |
105 | |
106 | returns Real |
107 | raises NotDone from StdFail |
108 | is static; |
109 | |
110 | |
111 | fields |
112 | |
113 | SCU: MultiCurve from AppParCurves; |
114 | ParError: Vector from math; |
115 | AvError: Real; |
116 | MError3d: Real; |
117 | MError2d: Real; |
118 | Done: Boolean; |
119 | |
120 | end Projection from AppParCurves; |