dri: Rework planar image interface
[mesa.git] / src / glu / sgi / libnurbs / internals / knotvector.cc
index b48efbd4bfad0e104e37f9c8880ee7aaee0f8ec8..dcbf0067d854762cb3f2a1a2c14c91ac2954b0f9 100644 (file)
@@ -35,8 +35,6 @@
 /*
  * knotvector.c++
  *
- * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
- * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/knotvector.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
  */
 
 #include "glimports.h"
 #include "knotvector.h"
 #include "defines.h"
 
+#ifdef __WATCOMC__
+#pragma warning 726 10
+#endif
 
 void Knotvector::init( long _knotcount, long _stride, long _order, INREAL *_knotlist )
 {
-    knotcount = _knotcount; 
-    stride = _stride; 
-    order = _order; 
+    knotcount = _knotcount;
+    stride = _stride;
+    order = _order;
     knotlist = new Knot[_knotcount];
     assert( knotlist != 0 );
 
     for( int i = 0; i != _knotcount; i++ )
-        knotlist[i] = (Knot) _knotlist[i]; 
+       knotlist[i] = (Knot) _knotlist[i];
 }
 
 Knotvector::Knotvector( void )
 {
+    knotcount = 0;
+    stride = 0;
+    order = 0;
     knotlist = 0;
 }
 
@@ -70,7 +74,7 @@ Knotvector::~Knotvector( void )
 
 int Knotvector::validate( void )
 {
-   /* kindex is used as an array index so subtract one first, 
+   /* kindex is used as an array index so subtract one first,
      * this propagates throughout the code so study carefully */
     long       kindex = knotcount-1;
 
@@ -85,7 +89,7 @@ int Knotvector::validate( void )
     }
 
     if( identical( knotlist[kindex-(order-1)], knotlist[order-1]) ) {
-       // valid knot range is empty 
+       // valid knot range is empty
        return( 3 );
     }
 
@@ -94,45 +98,45 @@ int Knotvector::validate( void )
            // decreasing knot sequence
            return( 4 );
        }
-       
+        
     /* check for valid multiplicity */
 
     /* kindex is currently the index of the last knot.
      * In the next loop  it is decremented to ignore the last knot
-     * and the loop stops when kindex  is 2 so as to ignore the first
-     *  knot as well.  These knots are not used in computing 
-     *  knot multiplicities.
+     * and the loop stops when kindex  is 2 so as to ignore the first
+     * knot as well.  These knots are not used in computing
+     * knot multiplicities.
      */
 
     long multi = 1;
     for( ; kindex >= 1; kindex-- ) {
        if( knotlist[kindex] - knotlist[kindex-1] < TOLERANCE ) {
-           multi++; 
+           multi++;
            continue;
-       } 
+       }
        if ( multi > order ) {
-            // knot multiplicity greater than order of spline
+           // knot multiplicity greater than order of spline
            return( 5 );
-       } 
+       }
        multi = 1;
     }
 
     if ( multi > order ) {
-        // knot multiplicity greater than order of spline
+       // knot multiplicity greater than order of spline
        return( 5 );
-    } 
+    }
 
     return 0;
 }
 
-void Knotvector::show( char *msg )
+void Knotvector::show( const char *msg )
 {
 #ifndef NDEBUG
-    dprintf( "%s\n", msg ); 
-    dprintf( "order = %ld, count = %ld\n", order, knotcount );
+    _glu_dprintf( "%s\n", msg );
+    _glu_dprintf( "order = %ld, count = %ld\n", order, knotcount );
 
     for( int i=0; i<knotcount; i++ )
-       dprintf( "knot[%d] = %g\n", i, knotlist[i] );
+       _glu_dprintf( "knot[%d] = %g\n", i, knotlist[i] );
 #endif
 }