2 -- Created: Fri Sep 20 15:07:26 1991
3 -- Author: Laurent PAINNOT
5 ---Copyright: Matra Datavision 1991
8 generic class Function from AppParCurves (
10 ToolLine as any; -- as ToolLine(MultiLine)
14 inherits MultipleVarFunctionWithGradient from math
16 ---Purpose: This function inherits MultipleVarFunctionWithGradient to be
17 -- used in the mathematical algorithm BFGS.
18 -- It computes the value of the function
19 -- F=sum(||Qui - B*Pi||)2 where Pi are Poles of the Bezier curves
20 -- approximating the given MultiLine SSP and ui the parameters
21 -- associated to the points Qi of SSP.
22 -- It also computes the gradient for values ui of the parameter.
25 uses MultiCurve from AppParCurves,
26 HArray1OfConstraintCouple from AppParCurves,
27 Constraint from AppParCurves,
30 HArray1OfInteger from TColStd
34 Create(SSP: MultiLine; FirstPoint, LastPoint: Integer;
35 TheConstraints: HArray1OfConstraintCouple;
36 Parameters: Vector; Deg: Integer)
37 ---Purpose: initializes the fields of the function. The approximating
38 -- curve has the desired degree Deg.
40 returns Function from AppParCurves;
44 ---Purpose: returns the number of variables of the function. It
45 -- corresponds to the number of MultiPoints.
52 Perform(me: in out; X: Vector)
53 ---Purpose: this method is used each time Value or Gradient is
59 Value(me: in out; X: Vector; F: out Real)
60 ---Purpose: this method computes the new approximation of the
62 -- SSP and calculates F = sum (||Pui - Bi*Pi||2) for each
63 -- point of the MultiLine.
69 Gradient(me: in out; X: Vector; G: out Vector)
70 ---Purpose: returns the gradient G of the sum above for the
77 Values(me: in out; X: Vector; F: out Real; G: out Vector)
78 ---Purpose: returns the value F=sum(||Pui - Bi*Pi||)2.
79 -- returns the value G = grad(F) for the parameters Xi.
87 ---Purpose: returns the new parameters of the MultiLine.
93 CurveValue(me: in out)
94 ---Purpose: returns the MultiCurve approximating the set after
95 -- computing the value F or Grad(F).
97 returns MultiCurve from AppParCurves
101 Error(me; IPoint, CurveIndex: Integer)
102 ---Purpose: returns the distance between the MultiPoint of range
103 -- IPoint and the curve CurveIndex.
110 ---Purpose: returns the maximum distance between the points
111 -- and the MultiCurve.
117 ---Purpose: returns the maximum distance between the points
118 -- and the MultiCurve.
124 FirstConstraint(me; TheConstraints: HArray1OfConstraintCouple;
128 returns Constraint from AppParCurves
132 LastConstraint(me; TheConstraints: HArray1OfConstraintCouple;
136 returns Constraint from AppParCurves
143 MyMultiLine : MultiLine;
144 MyMultiCurve: MultiCurve from AppParCurves;
146 myParameters: Vector;
148 ValGrad_F: Vector from math;
149 MyF: Matrix from math;
150 PTLX : Matrix from math;
151 PTLY : Matrix from math;
152 PTLZ : Matrix from math;
154 DA: Matrix from math;
155 MyLeastSquare : Squares;
156 Contraintes: Boolean;
161 tabdim: HArray1OfInteger from TColStd;
166 myConstraints: HArray1OfConstraintCouple from AppParCurves;