42cf5bc1 |
1 | // Created on: 1995-01-27 |
2 | // Created by: Jacques GOUSSARD |
3 | // Copyright (c) 1995-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 _GeomInt_MyBSplGradientOfTheComputeLineOfWLApprox_HeaderFile |
18 | #define _GeomInt_MyBSplGradientOfTheComputeLineOfWLApprox_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> |
42cf5bc1 |
27 | #include <Standard_Integer.hxx> |
28 | #include <AppParCurves_HArray1OfConstraintCouple.hxx> |
29 | #include <TColStd_Array1OfReal.hxx> |
30 | #include <TColStd_Array1OfInteger.hxx> |
31 | class Standard_OutOfRange; |
32 | class StdFail_NotDone; |
33 | class GeomInt_TheMultiLineOfWLApprox; |
34 | class GeomInt_TheMultiLineToolOfWLApprox; |
35 | class GeomInt_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfWLApprox; |
36 | class GeomInt_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfWLApprox; |
37 | class GeomInt_BSpGradient_BFGSOfMyBSplGradientOfTheComputeLineOfWLApprox; |
38 | class AppParCurves_MultiBSpCurve; |
39 | |
40 | |
41 | |
42 | class GeomInt_MyBSplGradientOfTheComputeLineOfWLApprox |
43 | { |
44 | public: |
45 | |
46 | DEFINE_STANDARD_ALLOC |
47 | |
48 | |
36b9ff75 |
49 | //! Tries to minimize the sum (square(||Qui - Bi*Pi||)) |
50 | //! where Pui describe the approximating BSpline 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 GeomInt_MyBSplGradientOfTheComputeLineOfWLApprox(const GeomInt_TheMultiLineOfWLApprox& 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); |
56 | |
36b9ff75 |
57 | //! Tries to minimize the sum (square(||Qui - Bi*Pi||)) |
58 | //! where Pui describe the approximating BSpline curves'Poles |
59 | //! and Qi the MultiLine points with a parameter ui. |
60 | //! In this algorithm, the parameters ui are the unknowns. |
61 | //! The tolerance required on this sum is given by Tol. |
62 | //! The desired degree of the resulting curve is Deg. |
42cf5bc1 |
63 | Standard_EXPORT GeomInt_MyBSplGradientOfTheComputeLineOfWLApprox(const GeomInt_TheMultiLineOfWLApprox& 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); |
64 | |
36b9ff75 |
65 | //! returns True if all has been correctly done. |
42cf5bc1 |
66 | Standard_EXPORT Standard_Boolean IsDone() const; |
67 | |
36b9ff75 |
68 | //! returns all the BSpline curves approximating the |
69 | //! MultiLine SSP after minimization of the parameter. |
42cf5bc1 |
70 | Standard_EXPORT AppParCurves_MultiBSpCurve Value() const; |
71 | |
36b9ff75 |
72 | //! returns the difference between the old and the new |
73 | //! approximation. |
74 | //! An exception is raised if NotDone. |
75 | //! An exception is raised if Index<1 or Index>NbParameters. |
42cf5bc1 |
76 | Standard_EXPORT Standard_Real Error (const Standard_Integer Index) const; |
77 | |
36b9ff75 |
78 | //! returns the maximum difference between the old and the |
79 | //! new approximation. |
42cf5bc1 |
80 | Standard_EXPORT Standard_Real MaxError3d() const; |
81 | |
36b9ff75 |
82 | //! returns the maximum difference between the old and the |
83 | //! new approximation. |
42cf5bc1 |
84 | Standard_EXPORT Standard_Real MaxError2d() const; |
85 | |
36b9ff75 |
86 | //! returns the average error between the old and the |
87 | //! new approximation. |
42cf5bc1 |
88 | Standard_EXPORT Standard_Real AverageError() const; |
89 | |
90 | |
91 | |
92 | |
93 | protected: |
94 | |
95 | |
96 | Standard_EXPORT void Perform (const GeomInt_TheMultiLineOfWLApprox& 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); |
97 | |
98 | |
99 | |
100 | |
101 | private: |
102 | |
103 | |
104 | |
105 | AppParCurves_MultiBSpCurve SCU; |
106 | math_Vector ParError; |
107 | Standard_Real AvError; |
108 | Standard_Real MError3d; |
109 | Standard_Real MError2d; |
110 | Standard_Real mylambda1; |
111 | Standard_Real mylambda2; |
112 | Standard_Boolean myIsLambdaDefined; |
113 | Standard_Boolean Done; |
114 | |
115 | |
116 | }; |
117 | |
118 | |
119 | |
120 | |
121 | |
122 | |
123 | |
124 | #endif // _GeomInt_MyBSplGradientOfTheComputeLineOfWLApprox_HeaderFile |