0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / AppDef / AppDef_MyBSplGradientOfBSplineCompute.hxx
CommitLineData
42cf5bc1 1// Created on: 1991-12-02
2// Created by: Laurent PAINNOT
3// Copyright (c) 1991-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
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
17#ifndef _AppDef_MyBSplGradientOfBSplineCompute_HeaderFile
18#define _AppDef_MyBSplGradientOfBSplineCompute_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <AppParCurves_MultiBSpCurve.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>
30#include <TColStd_Array1OfReal.hxx>
31#include <TColStd_Array1OfInteger.hxx>
32class Standard_OutOfRange;
33class StdFail_NotDone;
34class AppDef_MultiLine;
35class AppDef_MyLineTool;
36class AppDef_BSpParLeastSquareOfMyBSplGradientOfBSplineCompute;
37class AppDef_BSpParFunctionOfMyBSplGradientOfBSplineCompute;
38class AppDef_BSpGradient_BFGSOfMyBSplGradientOfBSplineCompute;
39class AppParCurves_MultiBSpCurve;
40
41
42
43class AppDef_MyBSplGradientOfBSplineCompute
44{
45public:
46
47 DEFINE_STANDARD_ALLOC
48
49
36b9ff75 50 //! Tries to minimize the sum (square(||Qui - Bi*Pi||))
51 //! where Pui describe the approximating BSpline curves'Poles
52 //! and Qi the MultiLine points with a parameter ui.
53 //! In this algorithm, the parameters ui are the unknowns.
54 //! The tolerance required on this sum is given by Tol.
55 //! The desired degree of the resulting curve is Deg.
42cf5bc1 56 Standard_EXPORT AppDef_MyBSplGradientOfBSplineCompute(const AppDef_MultiLine& SSP, const Standard_Integer FirstPoint, const Standard_Integer LastPoint, const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, math_Vector& Parameters, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Integer Deg, const Standard_Real Tol3d, const Standard_Real Tol2d, const Standard_Integer NbIterations = 1);
57
36b9ff75 58 //! Tries to minimize the sum (square(||Qui - Bi*Pi||))
59 //! where Pui describe the approximating BSpline curves'Poles
60 //! and Qi the MultiLine points with a parameter ui.
61 //! In this algorithm, the parameters ui are the unknowns.
62 //! The tolerance required on this sum is given by Tol.
63 //! The desired degree of the resulting curve is Deg.
42cf5bc1 64 Standard_EXPORT AppDef_MyBSplGradientOfBSplineCompute(const AppDef_MultiLine& SSP, const Standard_Integer FirstPoint, const Standard_Integer LastPoint, const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, math_Vector& Parameters, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Integer Deg, const Standard_Real Tol3d, const Standard_Real Tol2d, const Standard_Integer NbIterations, const Standard_Real lambda1, const Standard_Real lambda2);
65
36b9ff75 66 //! returns True if all has been correctly done.
42cf5bc1 67 Standard_EXPORT Standard_Boolean IsDone() const;
68
36b9ff75 69 //! returns all the BSpline curves approximating the
70 //! MultiLine SSP after minimization of the parameter.
42cf5bc1 71 Standard_EXPORT AppParCurves_MultiBSpCurve Value() const;
72
36b9ff75 73 //! 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.
42cf5bc1 77 Standard_EXPORT Standard_Real Error (const Standard_Integer Index) const;
78
36b9ff75 79 //! returns the maximum difference between the old and the
80 //! new approximation.
42cf5bc1 81 Standard_EXPORT Standard_Real MaxError3d() const;
82
36b9ff75 83 //! returns the maximum difference between the old and the
84 //! new approximation.
42cf5bc1 85 Standard_EXPORT Standard_Real MaxError2d() const;
86
36b9ff75 87 //! returns the average error between the old and the
88 //! new approximation.
42cf5bc1 89 Standard_EXPORT Standard_Real AverageError() const;
90
91
92
93
94protected:
95
96
97 Standard_EXPORT void Perform (const AppDef_MultiLine& SSP, const Standard_Integer FirstPoint, const Standard_Integer LastPoint, const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, math_Vector& Parameters, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Integer Deg, const Standard_Real Tol3d, const Standard_Real Tol2d, const Standard_Integer NbIterations = 200);
98
99
100
101
102private:
103
104
105
106 AppParCurves_MultiBSpCurve SCU;
107 math_Vector ParError;
108 Standard_Real AvError;
109 Standard_Real MError3d;
110 Standard_Real MError2d;
111 Standard_Real mylambda1;
112 Standard_Real mylambda2;
113 Standard_Boolean myIsLambdaDefined;
114 Standard_Boolean Done;
115
116
117};
118
119
120
121
122
123
124
125#endif // _AppDef_MyBSplGradientOfBSplineCompute_HeaderFile