CommitLineData
42cf5bc1 1// Created on: 1991-12-02
2// Created by: Laurent PAINNOT
3// Copyright (c) 1991-1999 Matra Datavision
5//
6// This file is part of Open CASCADE Technology software library.
7//
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
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <AppParCurves_MultiCurve.hxx>
25#include <math_Vector.hxx>
26#include <Standard_Real.hxx>
27#include <Standard_Boolean.hxx>
28#include <Standard_Integer.hxx>
29#include <AppParCurves_HArray1OfConstraintCouple.hxx>
30class Standard_OutOfRange;
31class StdFail_NotDone;
32class AppDef_MultiLine;
33class AppDef_MyLineTool;
38class AppParCurves_MultiCurve;
39
40
41
43{
44public:
45
46 DEFINE_STANDARD_ALLOC
47
48
36b9ff75 49 //! Tries to minimize the sum (square(||Qui - Bi*Pi||))
50 //! where Pui describe the approximating Bezier curves'Poles
51 //! and Qi the MultiLine points with a parameter ui.
52 //! In this algorithm, the parameters ui are the unknowns.
53 //! The tolerance required on this sum is given by Tol.
54 //! The desired degree of the resulting curve is Deg.
42cf5bc1 55 Standard_EXPORT AppDef_MyGradientOfCompute(const AppDef_MultiLine& SSP, const Standard_Integer FirstPoint, const Standard_Integer LastPoint, const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, math_Vector& Parameters, const Standard_Integer Deg, const Standard_Real Tol3d, const Standard_Real Tol2d, const Standard_Integer NbIterations = 200);
56
36b9ff75 57 //! returns True if all has been correctly done.
42cf5bc1 58 Standard_EXPORT Standard_Boolean IsDone() const;
59
36b9ff75 60 //! returns all the Bezier curves approximating the
61 //! MultiLine SSP after minimization of the parameter.
42cf5bc1 62 Standard_EXPORT AppParCurves_MultiCurve Value() const;
63
36b9ff75 64 //! returns the difference between the old and the new
65 //! approximation.
66 //! An exception is raised if NotDone.
67 //! An exception is raised if Index<1 or Index>NbParameters.
42cf5bc1 68 Standard_EXPORT Standard_Real Error (const Standard_Integer Index) const;
69
36b9ff75 70 //! returns the maximum difference between the old and the
71 //! new approximation.
42cf5bc1 72 Standard_EXPORT Standard_Real MaxError3d() const;
73
36b9ff75 74 //! returns the maximum difference between the old and the
75 //! new approximation.
42cf5bc1 76 Standard_EXPORT Standard_Real MaxError2d() const;
77
36b9ff75 78 //! returns the average error between the old and the
79 //! new approximation.
42cf5bc1 80 Standard_EXPORT Standard_Real AverageError() const;
81
82
83
84
85protected:
86
87
88
89
90
91private:
92
93
94
95 AppParCurves_MultiCurve SCU;
96 math_Vector ParError;
97 Standard_Real AvError;
98 Standard_Real MError3d;
99 Standard_Real MError2d;
100 Standard_Boolean Done;
101
102
103};
104
105
106
107
108
109
110