// Created on: 1995-05-29 // Created by: Xavier BENVENISTE // Copyright (c) 1995-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #ifndef _AdvApprox_ApproxAFunction_HeaderFile #define _AdvApprox_ApproxAFunction_HeaderFile #include "Standard.hxx" #include "Standard_DefineAlloc.hxx" #include "Standard_Handle.hxx" #include "Standard_Integer.hxx" #include "NCollection_Array1.hxx" #include "NCollection_HArray1.hxx" #include "Standard_Real.hxx" #include "GeomAbs_Shape.hxx" #include "Standard_Boolean.hxx" #include "NCollection_Array2.hxx" #include "NCollection_HArray2.hxx" #include "gp_Pnt2d.hxx" #include "gp_Pnt.hxx" #include "AdvApprox_EvaluatorFunction.hxx" #include "Standard_OStream.hxx" class AdvApprox_Cutting; //! this approximate a given function class AdvApprox_ApproxAFunction { public: DEFINE_STANDARD_ALLOC //! Constructs approximator tool. //! //! Warning: //! the Func should be valid reference to object of type //! inherited from class EvaluatorFunction from Approx //! with life time longer than that of the approximator tool; //! //! the result should be formatted in the following way : //! <--Num1DSS--> <--2 * Num2DSS--> <--3 * Num3DSS--> //! R[0] .... R[Num1DSS]..... R[Dimension-1] //! //! the order in which each Subspace appears should be consistent //! with the tolerances given in the create function and the //! results will be given in that order as well that is : //! Curve2d(n) will correspond to the nth entry //! described by Num2DSS, Curve(n) will correspond to //! the nth entry described by Num3DSS //! The same type of schema applies to the Poles1d, Poles2d and //! Poles. Standard_EXPORT AdvApprox_ApproxAFunction( const int Num1DSS, const int Num2DSS, const int Num3DSS, const occ::handle>& OneDTol, const occ::handle>& TwoDTol, const occ::handle>& ThreeDTol, const double First, const double Last, const GeomAbs_Shape Continuity, const int MaxDeg, const int MaxSeg, const AdvApprox_EvaluatorFunction& Func); //! Approximation with user method of cutting Standard_EXPORT AdvApprox_ApproxAFunction( const int Num1DSS, const int Num2DSS, const int Num3DSS, const occ::handle>& OneDTol, const occ::handle>& TwoDTol, const occ::handle>& ThreeDTol, const double First, const double Last, const GeomAbs_Shape Continuity, const int MaxDeg, const int MaxSeg, const AdvApprox_EvaluatorFunction& Func, const AdvApprox_Cutting& CutTool); Standard_EXPORT static void Approximation(const int TotalDimension, const int TotalNumSS, const NCollection_Array1& LocalDimension, const double First, const double Last, AdvApprox_EvaluatorFunction& Evaluator, const AdvApprox_Cutting& CutTool, const int ContinuityOrder, const int NumMaxCoeffs, const int MaxSegments, const NCollection_Array1& TolerancesArray, const int code_precis, int& NumCurves, NCollection_Array1& NumCoeffPerCurveArray, NCollection_Array1& LocalCoefficientArray, NCollection_Array1& IntervalsArray, NCollection_Array1& ErrorMaxArray, NCollection_Array1& AverageErrorArray, int& ErrorCode); bool IsDone() const; bool HasResult() const; //! returns the poles from the algorithms as is occ::handle> Poles1d() const; //! returns the poles from the algorithms as is occ::handle> Poles2d() const; //! -- returns the poles from the algorithms as is occ::handle> Poles() const; //! as the name says Standard_EXPORT int NbPoles() const; //! returns the poles at Index from the 1d subspace Standard_EXPORT void Poles1d(const int Index, NCollection_Array1& P) const; //! returns the poles at Index from the 2d subspace Standard_EXPORT void Poles2d(const int Index, NCollection_Array1& P) const; //! returns the poles at Index from the 3d subspace Standard_EXPORT void Poles(const int Index, NCollection_Array1& P) const; int Degree() const; int NbKnots() const; int NumSubSpaces(const int Dimension) const; occ::handle> Knots() const; occ::handle> Multiplicities() const; //! returns the error as is in the algorithms Standard_EXPORT occ::handle> MaxError(const int Dimension) const; //! returns the error as is in the algorithms Standard_EXPORT occ::handle> AverageError(const int Dimension) const; Standard_EXPORT double MaxError(const int Dimension, const int Index) const; Standard_EXPORT double AverageError(const int Dimension, const int Index) const; //! display information on approximation. Standard_EXPORT void Dump(Standard_OStream& o) const; private: Standard_EXPORT void Perform(const int Num1DSS, const int Num2DSS, const int Num3DSS, const AdvApprox_Cutting& CutTool); int myNumSubSpaces[3]; occ::handle> my1DTolerances; occ::handle> my2DTolerances; occ::handle> my3DTolerances; double myFirst; double myLast; GeomAbs_Shape myContinuity; int myMaxDegree; int myMaxSegments; bool myDone; bool myHasResult; occ::handle> my1DPoles; occ::handle> my2DPoles; occ::handle> my3DPoles; occ::handle> myKnots; occ::handle> myMults; int myDegree; void* myEvaluator; occ::handle> my1DMaxError; occ::handle> my1DAverageError; occ::handle> my2DMaxError; occ::handle> my2DAverageError; occ::handle> my3DMaxError; occ::handle> my3DAverageError; }; #include "AdvApprox_ApproxAFunction.lxx" #endif // _AdvApprox_ApproxAFunction_HeaderFile