1 -- Created on: 1993-04-22
2 -- Created by: Laurent PAINNOT
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 generic class LeastSquare from AppCont(MultiLine as any;
19 ---as TheToolLine(MultiLine)
24 uses Matrix from math,
26 Constraint from AppParCurves,
27 MultiCurve from AppParCurves
30 raises NotDone from StdFail,
31 OutOfRange from Standard,
32 DimensionError from Standard
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.
50 returns LeastSquare from AppCont
51 raises DimensionError from Standard;
56 ---Purpose: returns True if all has been correctly done.
63 ---Purpose: returns the result of the approximation, i.e. a
65 -- An exception is raised if NotDone.
66 ---C++: return const &
68 returns MultiCurve from AppParCurves
69 raises NotDone from StdFail
73 NbBColumns(me; SSP: MultiLine)
74 ---Purpose: is internally used by the constuctor.
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.
87 raises NotDone from StdFail
95 SCU: MultiCurve from AppParCurves;
105 end LeastSquare from AppCont;