1 // Created on: 1995-05-30
2 // Created by: Xavier BENVENISTE
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Convert_CompPolynomialToPoles_HeaderFile
18 #define _Convert_CompPolynomialToPoles_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <TColStd_HArray1OfReal.hxx>
25 #include <TColStd_HArray1OfInteger.hxx>
26 #include <TColStd_HArray2OfReal.hxx>
27 #include <Standard_Integer.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <TColStd_Array1OfInteger.hxx>
30 #include <TColStd_Array1OfReal.hxx>
31 #include <TColStd_Array2OfReal.hxx>
32 class Standard_OutOfRange;
33 class Standard_ConstructionError;
36 //! Convert a serie of Polynomial N-Dimensional Curves
37 //! that are have continuity CM to an N-Dimensional Bspline Curve
38 //! that has continuity CM.
39 //! (to convert an function (curve) polynomial by span in a BSpline)
40 //! This class uses the following arguments :
41 //! NumCurves : the number of Polynomial Curves
42 //! Continuity: the requested continuity for the n-dimensional Spline
43 //! Dimension : the dimension of the Spline
44 //! MaxDegree : maximum allowed degree for each composite
45 //! polynomial segment.
46 //! NumCoeffPerCurve : the number of coefficient per segments = degree - 1
47 //! Coefficients : the coefficients organized in the following way
48 //! [1..<myNumPolynomials>][1..myMaxDegree +1][1..myDimension]
49 //! that is : index [n,d,i] is at slot
50 //! (n-1) * (myMaxDegree + 1) * myDimension + (d-1) * myDimension + i
51 //! PolynomialIntervals : nth polynomial represents a polynomial between
52 //! myPolynomialIntervals->Value(n,0) and
53 //! myPolynomialIntervals->Value(n,1)
54 //! TrueIntervals : the nth polynomial has to be mapped linearly to be
55 //! defined on the following interval :
56 //! myTrueIntervals->Value(n) and myTrueIntervals->Value(n+1)
57 //! so that it represent adequatly the function with the
58 //! required continuity
59 class Convert_CompPolynomialToPoles
67 //! Continuity can be at MOST the maximum degree of
68 //! the polynomial functions
70 //! this is the true parameterisation for the composite curve
71 //! that is : the curve has myContinuity if the nth curve
72 //! is parameterized between myTrueIntervals(n) and myTrueIntervals(n+1)
74 //! Coefficients have to be the implicit "c form":
75 //! Coefficients[Numcurves][MaxDegree+1][Dimension]
78 //! The NumberOfCoefficient of an polynome is his degree + 1
79 //! Example: To convert the linear function f(x) = 2*x + 1 on the
80 //! domaine [2,5] to BSpline with the bound [-1,1]. Arguments are :
85 //! NumCoeffPerCurve [1] = {2};
86 //! Coefficients[2] = {1, 2};
87 //! PolynomialIntervals[1,2] = {{2,5}}
88 //! TrueIntervals[2] = {-1, 1}
89 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);
91 //! To Convert sevral span with different order of Continuity.
92 //! Warning: The Length of Continuity have to be NumCurves-1
93 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);
95 //! To Convert only one span.
96 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);
98 //! number of poles of the n-dimensional BSpline
99 Standard_EXPORT Standard_Integer NbPoles() const;
101 //! returns the poles of the n-dimensional BSpline
102 //! in the following format :
103 //! [1..NumPoles][1..Dimension]
104 Standard_EXPORT void Poles (Handle(TColStd_HArray2OfReal)& Poles) const;
106 Standard_EXPORT Standard_Integer Degree() const;
108 //! Degree of the n-dimensional Bspline
109 Standard_EXPORT Standard_Integer NbKnots() const;
111 //! Knots of the n-dimensional Bspline
112 Standard_EXPORT void Knots (Handle(TColStd_HArray1OfReal)& K) const;
114 //! Multiplicities of the knots in the BSpline
115 Standard_EXPORT void Multiplicities (Handle(TColStd_HArray1OfInteger)& M) const;
117 Standard_EXPORT Standard_Boolean IsDone() const;
131 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);
134 Handle(TColStd_HArray1OfReal) myFlatKnots;
135 Handle(TColStd_HArray1OfReal) myKnots;
136 Handle(TColStd_HArray1OfInteger) myMults;
137 Handle(TColStd_HArray2OfReal) myPoles;
138 Standard_Integer myDegree;
139 Standard_Boolean myDone;
150 #endif // _Convert_CompPolynomialToPoles_HeaderFile