Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:40

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_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfWLApprox_HeaderFile
0018 #define _GeomInt_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfWLApprox_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_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfWLApprox.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 GeomInt_TheMultiLineOfWLApprox;
0036 class GeomInt_TheMultiLineToolOfWLApprox;
0037 class GeomInt_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfWLApprox;
0038 class AppParCurves_MultiBSpCurve;
0039 class math_Matrix;
0040 
0041 
0042 
0043 class GeomInt_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfWLApprox  : public math_MultipleVarFunctionWithGradient
0044 {
0045 public:
0046 
0047   DEFINE_STANDARD_ALLOC
0048 
0049   
0050   //! initializes the fields of the function. The approximating
0051   //! curve has <NbPol> control points.
0052   Standard_EXPORT GeomInt_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfWLApprox(const GeomInt_TheMultiLineOfWLApprox& SSP, const Standard_Integer FirstPoint, const Standard_Integer LastPoint, const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, const math_Vector& Parameters, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Integer NbPol);
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 MultiBSpCurve approximating the set after
0076   //! computing the value F or Grad(F).
0077   Standard_EXPORT AppParCurves_MultiBSpCurve 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, const Standard_Integer CurveIndex);
0082   
0083   //! returns the maximum distance between the points
0084   //! and the MultiBSpCurve.
0085   Standard_EXPORT Standard_Real MaxError3d() const;
0086   
0087   //! returns the maximum distance between the points
0088   //! and the MultiBSpCurve.
0089   Standard_EXPORT Standard_Real MaxError2d() const;
0090   
0091   //! returns the function matrix used to approximate the
0092   //! multiline.
0093   Standard_EXPORT const math_Matrix& FunctionMatrix() const;
0094   
0095   //! returns the derivative function matrix used to approximate the
0096   //! multiline.
0097   Standard_EXPORT const math_Matrix& DerivativeFunctionMatrix() const;
0098   
0099   //! Returns the indexes of the first non null values of
0100   //! A and DA.
0101   //! The values are non null from Index(ieme point) +1
0102   //! to Index(ieme point) + degree +1.
0103   Standard_EXPORT const math_IntegerVector& Index() const;
0104   
0105   Standard_EXPORT AppParCurves_Constraint FirstConstraint (const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, const Standard_Integer FirstPoint) const;
0106   
0107   Standard_EXPORT AppParCurves_Constraint LastConstraint (const Handle(AppParCurves_HArray1OfConstraintCouple)& TheConstraints, const Standard_Integer LastPoint) const;
0108   
0109   Standard_EXPORT void SetFirstLambda (const Standard_Real l1);
0110   
0111   Standard_EXPORT void SetLastLambda (const Standard_Real l2);
0112 
0113 
0114 
0115 
0116 protected:
0117 
0118   
0119   //! this method is used each time Value or Gradient is
0120   //! needed.
0121   Standard_EXPORT void Perform (const math_Vector& X);
0122 
0123 
0124 
0125 
0126 private:
0127 
0128 
0129 
0130   Standard_Boolean Done;
0131   GeomInt_TheMultiLineOfWLApprox MyMultiLine;
0132   AppParCurves_MultiBSpCurve MyMultiBSpCurve;
0133   Standard_Integer nbpoles;
0134   math_Vector myParameters;
0135   Standard_Real FVal;
0136   math_Vector ValGrad_F;
0137   math_Matrix MyF;
0138   math_Matrix PTLX;
0139   math_Matrix PTLY;
0140   math_Matrix PTLZ;
0141   math_Matrix A;
0142   math_Matrix DA;
0143   GeomInt_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfWLApprox MyLeastSquare;
0144   Standard_Boolean Contraintes;
0145   Standard_Integer NbP;
0146   Standard_Integer NbCu;
0147   Standard_Integer Adeb;
0148   Standard_Integer Afin;
0149   Handle(TColStd_HArray1OfInteger) tabdim;
0150   Standard_Real ERR3d;
0151   Standard_Real ERR2d;
0152   Standard_Integer FirstP;
0153   Standard_Integer LastP;
0154   Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints;
0155   Standard_Real mylambda1;
0156   Standard_Real mylambda2;
0157 
0158 
0159 };
0160 
0161 
0162 
0163 
0164 
0165 
0166 
0167 #endif // _GeomInt_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfWLApprox_HeaderFile