Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-15 08:29:07

0001 // Created on: 1995-06-06
0002 // Created by: Jean Yves LEBEY
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 _BRepApprox_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfApprox_HeaderFile
0018 #define _BRepApprox_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfApprox_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <BRepApprox_TheMultiLineOfApprox.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <Standard_Real.hxx>
0027 #include <BRepApprox_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfApprox.hxx>
0028 #include <TColStd_HArray1OfInteger.hxx>
0029 #include <AppParCurves_HArray1OfConstraintCouple.hxx>
0030 #include <math_MultipleVarFunctionWithGradient.hxx>
0031 #include <TColStd_Array1OfReal.hxx>
0032 #include <TColStd_Array1OfInteger.hxx>
0033 #include <math_IntegerVector.hxx>
0034 #include <AppParCurves_Constraint.hxx>
0035 class BRepApprox_TheMultiLineOfApprox;
0036 class BRepApprox_TheMultiLineToolOfApprox;
0037 class BRepApprox_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfApprox;
0038 class AppParCurves_MultiBSpCurve;
0039 class math_Matrix;
0040 
0041 class BRepApprox_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfApprox
0042     : public math_MultipleVarFunctionWithGradient
0043 {
0044 public:
0045   DEFINE_STANDARD_ALLOC
0046 
0047   //! initializes the fields of the function. The approximating
0048   //! curve has <NbPol> control points.
0049   Standard_EXPORT BRepApprox_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfApprox(
0050     const BRepApprox_TheMultiLineOfApprox&                SSP,
0051     const Standard_Integer                                FirstPoint,
0052     const Standard_Integer                                LastPoint,
0053     const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints,
0054     const math_Vector&                                    Parameters,
0055     const TColStd_Array1OfReal&                           Knots,
0056     const TColStd_Array1OfInteger&                        Mults,
0057     const Standard_Integer                                NbPol);
0058 
0059   //! returns the number of variables of the function. It
0060   //! corresponds to the number of MultiPoints.
0061   Standard_EXPORT Standard_Integer NbVariables() const;
0062 
0063   //! this method computes the new approximation of the
0064   //! MultiLine
0065   //! SSP and calculates F = sum (||Pui - Bi*Pi||2) for each
0066   //! point of the MultiLine.
0067   Standard_EXPORT Standard_Boolean Value(const math_Vector& X, Standard_Real& F);
0068 
0069   //! returns the gradient G of the sum above for the
0070   //! parameters Xi.
0071   Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X, math_Vector& G);
0072 
0073   //! returns the value F=sum(||Pui - Bi*Pi||)2.
0074   //! returns the value G = grad(F) for the parameters Xi.
0075   Standard_EXPORT Standard_Boolean Values(const math_Vector& X, Standard_Real& F, math_Vector& G);
0076 
0077   //! returns the new parameters of the MultiLine.
0078   Standard_EXPORT const math_Vector& NewParameters() const;
0079 
0080   //! returns the MultiBSpCurve approximating the set after
0081   //! computing the value F or Grad(F).
0082   Standard_EXPORT AppParCurves_MultiBSpCurve CurveValue();
0083 
0084   //! returns the distance between the MultiPoint of range
0085   //! IPoint and the curve CurveIndex.
0086   Standard_EXPORT Standard_Real Error(const Standard_Integer IPoint,
0087                                       const Standard_Integer CurveIndex);
0088 
0089   //! returns the maximum distance between the points
0090   //! and the MultiBSpCurve.
0091   Standard_EXPORT Standard_Real MaxError3d() const;
0092 
0093   //! returns the maximum distance between the points
0094   //! and the MultiBSpCurve.
0095   Standard_EXPORT Standard_Real MaxError2d() const;
0096 
0097   //! returns the function matrix used to approximate the
0098   //! multiline.
0099   Standard_EXPORT const math_Matrix& FunctionMatrix() const;
0100 
0101   //! returns the derivative function matrix used to approximate the
0102   //! multiline.
0103   Standard_EXPORT const math_Matrix& DerivativeFunctionMatrix() const;
0104 
0105   //! Returns the indexes of the first non null values of
0106   //! A and DA.
0107   //! The values are non null from Index(ieme point) +1
0108   //! to Index(ieme point) + degree +1.
0109   Standard_EXPORT const math_IntegerVector& Index() const;
0110 
0111   Standard_EXPORT AppParCurves_Constraint
0112     FirstConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints,
0113                     const Standard_Integer                                FirstPoint) const;
0114 
0115   Standard_EXPORT AppParCurves_Constraint
0116     LastConstraint(const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints,
0117                    const Standard_Integer                                LastPoint) const;
0118 
0119   Standard_EXPORT void SetFirstLambda(const Standard_Real l1);
0120 
0121   Standard_EXPORT void SetLastLambda(const Standard_Real l2);
0122 
0123 protected:
0124   //! this method is used each time Value or Gradient is
0125   //! needed.
0126   Standard_EXPORT void Perform(const math_Vector& X);
0127 
0128 private:
0129   Standard_Boolean                                                     Done;
0130   BRepApprox_TheMultiLineOfApprox                                      MyMultiLine;
0131   AppParCurves_MultiBSpCurve                                           MyMultiBSpCurve;
0132   Standard_Integer                                                     nbpoles;
0133   math_Vector                                                          myParameters;
0134   Standard_Real                                                        FVal;
0135   math_Vector                                                          ValGrad_F;
0136   math_Matrix                                                          MyF;
0137   math_Matrix                                                          PTLX;
0138   math_Matrix                                                          PTLY;
0139   math_Matrix                                                          PTLZ;
0140   math_Matrix                                                          A;
0141   math_Matrix                                                          DA;
0142   BRepApprox_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfApprox MyLeastSquare;
0143   Standard_Boolean                                                     Contraintes;
0144   Standard_Integer                                                     NbP;
0145   Standard_Integer                                                     NbCu;
0146   Standard_Integer                                                     Adeb;
0147   Standard_Integer                                                     Afin;
0148   Handle(TColStd_HArray1OfInteger)                                     tabdim;
0149   Standard_Real                                                        ERR3d;
0150   Standard_Real                                                        ERR2d;
0151   Standard_Integer                                                     FirstP;
0152   Standard_Integer                                                     LastP;
0153   Handle(AppParCurves_HArray1OfConstraintCouple)                       myConstraints;
0154   Standard_Real                                                        mylambda1;
0155   Standard_Real                                                        mylambda2;
0156 };
0157 
0158 #endif // _BRepApprox_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfApprox_HeaderFile