Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-25 08:29:36

0001 // Created on: 1995-01-27
0002 // Created by: Jacques GOUSSARD
0003 // Copyright (c) 1995-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _GeomInt_ParFunctionOfMyGradientOfTheComputeLineBezierOfWLApprox_HeaderFile
0018 #define _GeomInt_ParFunctionOfMyGradientOfTheComputeLineBezierOfWLApprox_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <GeomInt_TheMultiLineOfWLApprox.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <Standard_Real.hxx>
0027 #include <GeomInt_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfWLApprox.hxx>
0028 #include <TColStd_HArray1OfInteger.hxx>
0029 #include <AppParCurves_HArray1OfConstraintCouple.hxx>
0030 #include <math_MultipleVarFunctionWithGradient.hxx>
0031 #include <AppParCurves_Constraint.hxx>
0032 class GeomInt_TheMultiLineOfWLApprox;
0033 class GeomInt_TheMultiLineToolOfWLApprox;
0034 class GeomInt_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfWLApprox;
0035 class GeomInt_ResConstraintOfMyGradientOfTheComputeLineBezierOfWLApprox;
0036 class AppParCurves_MultiCurve;
0037 
0038 class GeomInt_ParFunctionOfMyGradientOfTheComputeLineBezierOfWLApprox
0039     : public math_MultipleVarFunctionWithGradient
0040 {
0041 public:
0042   DEFINE_STANDARD_ALLOC
0043 
0044   //! initializes the fields of the function. The approximating
0045   //! curve has the desired degree Deg.
0046   Standard_EXPORT GeomInt_ParFunctionOfMyGradientOfTheComputeLineBezierOfWLApprox(
0047     const GeomInt_TheMultiLineOfWLApprox&                 SSP,
0048     const Standard_Integer                                FirstPoint,
0049     const Standard_Integer                                LastPoint,
0050     const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints,
0051     const math_Vector&                                    Parameters,
0052     const Standard_Integer                                Deg);
0053 
0054   //! returns the number of variables of the function. It
0055   //! corresponds to the number of MultiPoints.
0056   Standard_EXPORT Standard_Integer NbVariables() const;
0057 
0058   //! this method computes the new approximation of the
0059   //! MultiLine
0060   //! SSP and calculates F = sum (||Pui - Bi*Pi||2) for each
0061   //! point of the MultiLine.
0062   Standard_EXPORT Standard_Boolean Value(const math_Vector& X, Standard_Real& F);
0063 
0064   //! returns the gradient G of the sum above for the
0065   //! parameters Xi.
0066   Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X, math_Vector& G);
0067 
0068   //! returns the value F=sum(||Pui - Bi*Pi||)2.
0069   //! returns the value G = grad(F) for the parameters Xi.
0070   Standard_EXPORT Standard_Boolean Values(const math_Vector& X, Standard_Real& F, math_Vector& G);
0071 
0072   //! returns the new parameters of the MultiLine.
0073   Standard_EXPORT const math_Vector& NewParameters() const;
0074 
0075   //! returns the MultiCurve approximating the set after
0076   //! computing the value F or Grad(F).
0077   Standard_EXPORT const AppParCurves_MultiCurve& CurveValue();
0078 
0079   //! returns the distance between the MultiPoint of range
0080   //! IPoint and the curve CurveIndex.
0081   Standard_EXPORT Standard_Real Error(const Standard_Integer IPoint,
0082                                       const Standard_Integer CurveIndex) const;
0083 
0084   //! returns the maximum distance between the points
0085   //! and the MultiCurve.
0086   Standard_EXPORT Standard_Real MaxError3d() const;
0087 
0088   //! returns the maximum distance between the points
0089   //! and the MultiCurve.
0090   Standard_EXPORT Standard_Real MaxError2d() const;
0091 
0092   Standard_EXPORT AppParCurves_Constraint
0093     FirstConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints,
0094                     const Standard_Integer                                FirstPoint) const;
0095 
0096   Standard_EXPORT AppParCurves_Constraint
0097     LastConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints,
0098                    const Standard_Integer                                LastPoint) const;
0099 
0100 protected:
0101   //! this method is used each time Value or Gradient is
0102   //! needed.
0103   Standard_EXPORT void Perform(const math_Vector& X);
0104 
0105 private:
0106   Standard_Boolean                                                   Done;
0107   GeomInt_TheMultiLineOfWLApprox                                     MyMultiLine;
0108   AppParCurves_MultiCurve                                            MyMultiCurve;
0109   Standard_Integer                                                   Degre;
0110   math_Vector                                                        myParameters;
0111   Standard_Real                                                      FVal;
0112   math_Vector                                                        ValGrad_F;
0113   math_Matrix                                                        MyF;
0114   math_Matrix                                                        PTLX;
0115   math_Matrix                                                        PTLY;
0116   math_Matrix                                                        PTLZ;
0117   math_Matrix                                                        A;
0118   math_Matrix                                                        DA;
0119   GeomInt_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfWLApprox MyLeastSquare;
0120   Standard_Boolean                                                   Contraintes;
0121   Standard_Integer                                                   NbP;
0122   Standard_Integer                                                   NbCu;
0123   Standard_Integer                                                   Adeb;
0124   Standard_Integer                                                   Afin;
0125   Handle(TColStd_HArray1OfInteger)                                   tabdim;
0126   Standard_Real                                                      ERR3d;
0127   Standard_Real                                                      ERR2d;
0128   Standard_Integer                                                   FirstP;
0129   Standard_Integer                                                   LastP;
0130   Handle(AppParCurves_HArray1OfConstraintCouple)                     myConstraints;
0131 };
0132 
0133 #endif // _GeomInt_ParFunctionOfMyGradientOfTheComputeLineBezierOfWLApprox_HeaderFile