Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:56

0001 // Created on: 1991-12-02
0002 // Created by: Laurent PAINNOT
0003 // Copyright (c) 1991-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 _AppDef_Compute_HeaderFile
0018 #define _AppDef_Compute_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <AppParCurves_SequenceOfMultiCurve.hxx>
0025 #include <AppParCurves_MultiCurve.hxx>
0026 #include <AppParCurves_MultiBSpCurve.hxx>
0027 #include <Approx_ParametrizationType.hxx>
0028 #include <TColStd_HArray1OfReal.hxx>
0029 #include <Approx_SequenceOfHArray1OfReal.hxx>
0030 #include <TColStd_SequenceOfReal.hxx>
0031 #include <AppParCurves_HArray1OfConstraintCouple.hxx>
0032 #include <Standard_Integer.hxx>
0033 #include <AppParCurves_Constraint.hxx>
0034 #include <math_Vector.hxx>
0035 #include <TColStd_Array1OfReal.hxx>
0036 class AppDef_MultiLine;
0037 class AppDef_MyLineTool;
0038 class AppDef_MyGradientOfCompute;
0039 class AppDef_ParLeastSquareOfMyGradientOfCompute;
0040 class AppDef_ResConstraintOfMyGradientOfCompute;
0041 class AppDef_ParFunctionOfMyGradientOfCompute;
0042 class AppDef_Gradient_BFGSOfMyGradientOfCompute;
0043 class AppParCurves_MultiCurve;
0044 class AppParCurves_MultiBSpCurve;
0045 
0046 
0047 
0048 class AppDef_Compute 
0049 {
0050 public:
0051 
0052   DEFINE_STANDARD_ALLOC
0053 
0054   
0055   //! The MultiLine <Line> will be approximated until tolerances
0056   //! will be reached.
0057   //! The approximation will be done from degreemin to degreemax
0058   //! with a cutting if the corresponding boolean is True.
0059   //! If <Squares> is True, the computation will be done with
0060   //! no iteration at all.
0061   Standard_EXPORT AppDef_Compute(const AppDef_MultiLine& Line, const Standard_Integer degreemin = 4, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-3, const Standard_Real Tolerance2d = 1.0e-6, const Standard_Integer NbIterations = 5, const Standard_Boolean cutting = Standard_True, const Approx_ParametrizationType parametrization = Approx_ChordLength, const Standard_Boolean Squares = Standard_False);
0062   
0063   //! The MultiLine <Line> will be approximated until tolerances
0064   //! will be reached.
0065   //! The approximation will be done from degreemin to degreemax
0066   //! with a cutting if the corresponding boolean is True.
0067   //! If <Squares> is True, the computation will be done with
0068   //! no iteration at all.
0069   Standard_EXPORT AppDef_Compute(const AppDef_MultiLine& Line, const math_Vector& Parameters, const Standard_Integer degreemin = 4, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-03, const Standard_Real Tolerance2d = 1.0e-06, const Standard_Integer NbIterations = 5, const Standard_Boolean cutting = Standard_True, const Standard_Boolean Squares = Standard_False);
0070   
0071   //! Initializes the fields of the algorithm.
0072   Standard_EXPORT AppDef_Compute(const math_Vector& Parameters, const Standard_Integer degreemin = 4, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-03, const Standard_Real Tolerance2d = 1.0e-06, const Standard_Integer NbIterations = 5, const Standard_Boolean cutting = Standard_True, const Standard_Boolean Squares = Standard_False);
0073   
0074   //! Initializes the fields of the algorithm.
0075   Standard_EXPORT AppDef_Compute(const Standard_Integer degreemin = 4, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-03, const Standard_Real Tolerance2d = 1.0e-06, const Standard_Integer NbIterations = 5, const Standard_Boolean cutting = Standard_True, const Approx_ParametrizationType parametrization = Approx_ChordLength, const Standard_Boolean Squares = Standard_False);
0076   
0077   //! Initializes the fields of the algorithm.
0078   Standard_EXPORT void Init (const Standard_Integer degreemin = 4, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-03, const Standard_Real Tolerance2d = 1.0e-06, const Standard_Integer NbIterations = 5, const Standard_Boolean cutting = Standard_True, const Approx_ParametrizationType parametrization = Approx_ChordLength, const Standard_Boolean Squares = Standard_False);
0079   
0080   //! runs the algorithm after having initialized the fields.
0081   Standard_EXPORT void Perform (const AppDef_MultiLine& Line);
0082   
0083   //! changes the degrees of the approximation.
0084   Standard_EXPORT void SetDegrees (const Standard_Integer degreemin, const Standard_Integer degreemax);
0085   
0086   //! Changes the tolerances of the approximation.
0087   Standard_EXPORT void SetTolerances (const Standard_Real Tolerance3d, const Standard_Real Tolerance2d);
0088   
0089   //! changes the first and the last constraint points.
0090   Standard_EXPORT void SetConstraints (const AppParCurves_Constraint firstC, const AppParCurves_Constraint lastC);
0091   
0092   //! returns False if at a moment of the approximation,
0093   //! the status NoApproximation has been sent by the user
0094   //! when more points were needed.
0095   Standard_EXPORT Standard_Boolean IsAllApproximated() const;
0096   
0097   //! returns False if the status NoPointsAdded has been sent.
0098   Standard_EXPORT Standard_Boolean IsToleranceReached() const;
0099   
0100   //! returns the tolerances 2d and 3d of the <Index> MultiCurve.
0101   Standard_EXPORT void Error (const Standard_Integer Index, Standard_Real& tol3d, Standard_Real& tol2d) const;
0102   
0103   //! Returns the number of MultiCurve doing the approximation
0104   //! of the MultiLine.
0105   Standard_EXPORT Standard_Integer NbMultiCurves() const;
0106   
0107   //! returns the result of the approximation.
0108   Standard_EXPORT const AppParCurves_MultiCurve& Value (const Standard_Integer Index = 1) const;
0109   
0110   //! returns the result of the approximation.
0111   Standard_EXPORT AppParCurves_MultiCurve& ChangeValue (const Standard_Integer Index = 1);
0112   
0113   //! returns the result of the approximation.
0114   Standard_EXPORT const AppParCurves_MultiBSpCurve& SplineValue();
0115   
0116   //! returns the type  of  parametrization
0117   Standard_EXPORT Approx_ParametrizationType Parametrization () const;
0118   
0119   //! returns the new parameters of the approximation
0120   //! corresponding to the points of the multicurve <Index>.
0121   Standard_EXPORT const TColStd_Array1OfReal& Parameters (const Standard_Integer Index = 1) const;
0122 
0123 
0124 
0125 protected:
0126 
0127 
0128 
0129 
0130 
0131 private:
0132 
0133   
0134   //! is internally used in the algorithm.
0135   Standard_EXPORT Standard_Boolean Compute (const AppDef_MultiLine& Line,
0136                                             const Standard_Integer fpt,
0137                                             const Standard_Integer lpt,
0138                                             math_Vector& Para,
0139                                             Standard_Real& TheTol3d,
0140                                             Standard_Real& TheTol2d,
0141                                             Standard_Integer& indbad);
0142   
0143   //! is internally used in the algorithm.
0144   Standard_EXPORT Standard_Boolean ComputeCurve (const AppDef_MultiLine& Line, const Standard_Integer firspt, const Standard_Integer lastpt);
0145   
0146   //! computes new parameters between firstP and lastP.
0147   Standard_EXPORT void Parameters (const AppDef_MultiLine& Line, const Standard_Integer firstP, const Standard_Integer LastP, math_Vector& TheParameters) const;
0148   
0149   Standard_EXPORT Standard_Real SearchFirstLambda (const AppDef_MultiLine& Line, const math_Vector& Para, const math_Vector& V, const Standard_Integer index) const;
0150   
0151   Standard_EXPORT Standard_Real SearchLastLambda (const AppDef_MultiLine& Line, const math_Vector& Para, const math_Vector& V, const Standard_Integer index) const;
0152   
0153   Standard_EXPORT void FirstTangencyVector (const AppDef_MultiLine& Line, const Standard_Integer index, math_Vector& V) const;
0154   
0155   Standard_EXPORT void LastTangencyVector (const AppDef_MultiLine& Line, const Standard_Integer index, math_Vector& V) const;
0156 
0157 
0158   AppParCurves_SequenceOfMultiCurve myMultiCurves;
0159   AppParCurves_MultiCurve TheMultiCurve;
0160   AppParCurves_MultiBSpCurve myspline;
0161   Standard_Boolean alldone;
0162   Standard_Boolean tolreached;
0163   Approx_ParametrizationType Par;
0164   Handle(TColStd_HArray1OfReal) myParameters;
0165   Handle(TColStd_HArray1OfReal) myfirstParam;
0166   Approx_SequenceOfHArray1OfReal myPar;
0167   TColStd_SequenceOfReal Tolers3d;
0168   TColStd_SequenceOfReal Tolers2d;
0169   Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints;
0170   Standard_Integer mydegremin;
0171   Standard_Integer mydegremax;
0172   Standard_Real mytol3d;
0173   Standard_Real mytol2d;
0174   Standard_Real currenttol3d;
0175   Standard_Real currenttol2d;
0176   Standard_Boolean mycut;
0177   Standard_Boolean mysquares;
0178   Standard_Integer myitermax;
0179   AppParCurves_Constraint myfirstC;
0180   AppParCurves_Constraint mylastC;
0181   Standard_Integer myMultiLineNb;
0182   Standard_Boolean myIsClear;
0183 
0184 
0185 };
0186 
0187 
0188 
0189 
0190 
0191 
0192 
0193 #endif // _AppDef_Compute_HeaderFile