// BisepticReader.cpp : Simple reader/printer for binary biseptic basis functions // // Author: Charles Loop (cloop@microsoft.com) // #include // the maximum valace #define MAX_N 12 // the number of basis function coefficient corresponding to the maximum valence #define NUM_BF_COEFFS (MAX_N-2)*(MAX_N+11)*64 int main ( int argc, char ** argv ) { // space for basis function coefficients double DBFcoeffs[NUM_BF_COEFFS]; FILE* fp = NULL; // use this file for minimum energy solution //char* filename = "BisepticBF3to12.dat"; // use this file to interpolate Catmull-Clark limit position char* filename = "BisepticBFwLimit3to12.dat"; // read the data if ( !(fp = fopen ( filename, "rb" )) ) return 1; fread ( DBFcoeffs, sizeof(double), NUM_BF_COEFFS, fp ); fclose ( fp ); // iterate over valence for (int n = 3; n <= MAX_N; n++) { // base index for the valence n set of 2*n+8 basis functions unsigned int base = 64*(n*(n+7)-30); for (int k = 0; k < 2*n+8; k++) { printf( "n=%d k=%d\n", n, k ); // basis functions are in biseptic Bezier form (8x8 control nets) for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { printf( "%7.4f ", DBFcoeffs[base + 64*k + 8*i + j] ); } printf( "\n" ); } printf( "\n" ); } printf( "\n\n\n" ); } return 0; }