40 #include "glimports.h"
43 #include "knotvector.h"
47 #pragma warning 726 10
50 void Knotvector::init(
long _knotcount,
long _stride,
long _order, INREAL *_knotlist )
52 knotcount = _knotcount;
55 knotlist =
new Knot[_knotcount];
56 assert( knotlist != 0 );
58 for(
int i = 0; i != _knotcount; i++ )
59 knotlist[i] = (Knot) _knotlist[i];
62 Knotvector::Knotvector(
void )
67 Knotvector::~Knotvector(
void )
69 if( knotlist )
delete[] knotlist;
72 int Knotvector::validate(
void )
76 long kindex = knotcount-1;
78 if( order < 1 || order > MAXORDER ) {
83 if( knotcount < (2 * order) ) {
88 if( identical( knotlist[kindex-(order-1)], knotlist[order-1]) ) {
93 for(
long i = 0; i < kindex; i++)
94 if( knotlist[i] > knotlist[i+1] ) {
109 for( ; kindex >= 1; kindex-- ) {
110 if( knotlist[kindex] - knotlist[kindex-1] < TOLERANCE ) {
114 if ( multi > order ) {
121 if ( multi > order ) {
129 void Knotvector::show(
const char *msg )
132 _glu_dprintf(
"%s\n", msg );
133 _glu_dprintf(
"order = %ld, count = %ld\n", order, knotcount );
135 for(
int i=0; i<knotcount; i++ )
136 _glu_dprintf(
"knot[%d] = %g\n", i, knotlist[i] );