Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1995-05-30
0002 // Created by: Xavier BENVENISTE
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 _Convert_CompPolynomialToPoles_HeaderFile
0018 #define _Convert_CompPolynomialToPoles_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TColStd_HArray1OfReal.hxx>
0025 #include <TColStd_HArray1OfInteger.hxx>
0026 #include <TColStd_HArray2OfReal.hxx>
0027 #include <Standard_Integer.hxx>
0028 #include <TColStd_Array1OfInteger.hxx>
0029 #include <TColStd_Array1OfReal.hxx>
0030 #include <TColStd_Array2OfReal.hxx>
0031 
0032 
0033 //! Convert a serie of Polynomial N-Dimensional Curves
0034 //! that are have continuity CM to an N-Dimensional Bspline Curve
0035 //! that has continuity CM.
0036 //! (to convert an function (curve) polynomial by span in a BSpline)
0037 //! This class uses the following arguments :
0038 //! NumCurves :  the number of Polynomial Curves
0039 //! Continuity:  the requested continuity for the n-dimensional Spline
0040 //! Dimension :  the dimension of the Spline
0041 //! MaxDegree :  maximum allowed degree for each composite
0042 //! polynomial segment.
0043 //! NumCoeffPerCurve : the number of coefficient per segments = degree - 1
0044 //! Coefficients  :  the coefficients organized in the following way
0045 //! [1..<myNumPolynomials>][1..myMaxDegree +1][1..myDimension]
0046 //! that is : index [n,d,i] is at slot
0047 //! (n-1) * (myMaxDegree + 1) * myDimension + (d-1) * myDimension + i
0048 //! PolynomialIntervals :  nth polynomial represents a polynomial between
0049 //! myPolynomialIntervals->Value(n,0) and
0050 //! myPolynomialIntervals->Value(n,1)
0051 //! TrueIntervals : the nth polynomial has to be mapped linearly to be
0052 //! defined on the following interval :
0053 //! myTrueIntervals->Value(n) and myTrueIntervals->Value(n+1)
0054 //! so that it represent adequatly the function with the
0055 //! required continuity
0056 class Convert_CompPolynomialToPoles 
0057 {
0058 public:
0059 
0060   DEFINE_STANDARD_ALLOC
0061 
0062   
0063   //! Warning!
0064   //! Continuity can be at MOST the maximum degree of
0065   //! the polynomial functions
0066   //! TrueIntervals :
0067   //! this is the true parameterisation for the composite curve
0068   //! that is : the curve has myContinuity if the nth curve
0069   //! is parameterized between myTrueIntervals(n) and myTrueIntervals(n+1)
0070   //!
0071   //! Coefficients have to be the implicit "c form":
0072   //! Coefficients[Numcurves][MaxDegree+1][Dimension]
0073   //!
0074   //! Warning!
0075   //! The NumberOfCoefficient of an polynome is his degree + 1
0076   //! Example: To convert the linear function f(x) = 2*x + 1 on the
0077   //! domaine [2,5] to BSpline with the bound [-1,1]. Arguments are :
0078   //! NumCurves  = 1;
0079   //! Continuity = 1;
0080   //! Dimension  = 1;
0081   //! MaxDegree  = 1;
0082   //! NumCoeffPerCurve [1] = {2};
0083   //! Coefficients[2] = {1, 2};
0084   //! PolynomialIntervals[1,2] = {{2,5}}
0085   //! TrueIntervals[2] = {-1, 1}
0086   Standard_EXPORT Convert_CompPolynomialToPoles(const Standard_Integer NumCurves, const Standard_Integer Continuity, const Standard_Integer Dimension, const Standard_Integer MaxDegree, const Handle(TColStd_HArray1OfInteger)& NumCoeffPerCurve, const Handle(TColStd_HArray1OfReal)& Coefficients, const Handle(TColStd_HArray2OfReal)& PolynomialIntervals, const Handle(TColStd_HArray1OfReal)& TrueIntervals);
0087   
0088   //! To Convert sevral span with different order of Continuity.
0089   //! Warning: The Length of Continuity have to be NumCurves-1
0090   Standard_EXPORT Convert_CompPolynomialToPoles(const Standard_Integer NumCurves, const Standard_Integer Dimension, const Standard_Integer MaxDegree, const TColStd_Array1OfInteger& Continuity, const TColStd_Array1OfInteger& NumCoeffPerCurve, const TColStd_Array1OfReal& Coefficients, const TColStd_Array2OfReal& PolynomialIntervals, const TColStd_Array1OfReal& TrueIntervals);
0091   
0092   //! To Convert only one span.
0093   Standard_EXPORT Convert_CompPolynomialToPoles(const Standard_Integer Dimension, const Standard_Integer MaxDegree, const Standard_Integer Degree, const TColStd_Array1OfReal& Coefficients, const TColStd_Array1OfReal& PolynomialIntervals, const TColStd_Array1OfReal& TrueIntervals);
0094   
0095   //! number of poles of the n-dimensional BSpline
0096   Standard_EXPORT Standard_Integer NbPoles() const;
0097   
0098   //! returns the poles of the n-dimensional BSpline
0099   //! in the following format :
0100   //! [1..NumPoles][1..Dimension]
0101   Standard_EXPORT void Poles (Handle(TColStd_HArray2OfReal)& Poles) const;
0102   
0103   Standard_EXPORT Standard_Integer Degree() const;
0104   
0105   //! Degree of the n-dimensional Bspline
0106   Standard_EXPORT Standard_Integer NbKnots() const;
0107   
0108   //! Knots of the n-dimensional Bspline
0109   Standard_EXPORT void Knots (Handle(TColStd_HArray1OfReal)& K) const;
0110   
0111   //! Multiplicities of the knots in the BSpline
0112   Standard_EXPORT void Multiplicities (Handle(TColStd_HArray1OfInteger)& M) const;
0113   
0114   Standard_EXPORT Standard_Boolean IsDone() const;
0115 
0116 
0117 
0118 
0119 protected:
0120 
0121 
0122 
0123 
0124 
0125 private:
0126 
0127   
0128   Standard_EXPORT void Perform (const Standard_Integer NumCurves, const Standard_Integer MaxDegree, const Standard_Integer Dimension, const TColStd_Array1OfInteger& NumCoeffPerCurve, const TColStd_Array1OfReal& Coefficients, const TColStd_Array2OfReal& PolynomialIntervals, const TColStd_Array1OfReal& TrueIntervals);
0129 
0130 
0131   Handle(TColStd_HArray1OfReal) myFlatKnots;
0132   Handle(TColStd_HArray1OfReal) myKnots;
0133   Handle(TColStd_HArray1OfInteger) myMults;
0134   Handle(TColStd_HArray2OfReal) myPoles;
0135   Standard_Integer myDegree;
0136   Standard_Boolean myDone;
0137 
0138 
0139 };
0140 
0141 
0142 
0143 
0144 
0145 
0146 
0147 #endif // _Convert_CompPolynomialToPoles_HeaderFile