1 /*
2  * NurbsCurveDegreeElevate.h
3  *
4  * Copyright (C) 2003 Th. Rothermel
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program (see the file "COPYING" for details); if
18  * not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19  * Cambridge, MA 02139, USA.
20  */
21 
22 #ifndef _NURBS_CURVE_DEGREE_ELEVATE_H
23 #define _NURBS_CURVE_DEGREE_ELEVATE_H
24 
25 #ifndef _VEC3F_H
26 #include "Vec3f.h"
27 #endif
28 #ifndef _ARRAY_H
29 #include "Array.h"
30 #endif
31 
32 class NurbsCurveDegreeElevate {
33 public:
34                   NurbsCurveDegreeElevate(Vec3f controlPoints[],
35                                           float weights[], MyArray<float> knots,
36                                           int dimension,
37                                           int pDegree, int upDegree);
getKnotSize()38      int          getKnotSize() {return newKnots.size();}
getPointSize()39      int          getPointSize() {return newPoints.size();}
getWeightSize()40      int          getWeightSize() {return newWeights.size();}
getControlPoints(int index)41      Vec3f        getControlPoints(int index) {return newPoints[index];}
getWeights(int index)42      float        getWeights(int index) {return newWeights[index];}
getKnots(int index)43      float        getKnots(int index) {return newKnots[index];}
44 
45 protected:
46      MyArray<Vec3f> newPoints;
47      MyArray<float> newWeights;
48      MyArray<float> newKnots;
49      MyArray<int>   binomi;
50 
51      void         makeBinomi(int n, int k);
getBinomi(int n,int k)52      int          getBinomi(int n, int k){return(binomi[(n*max)+n+k]);}
53      int          max;
54      int          minimum(int a, int b);
55      int          maximum(int a, int b);
56 };
57 
58 #endif // _NURBS_CURVE_DEGREE_ELEVATE_H
59