[brlcad-commits] SF.net SVN: brlcad:[37700] brlcad/trunk
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <br...@us...> - 2010-02-21 18:08:45
|
Revision: 37700 http://brlcad.svn.sourceforge.net/brlcad/?rev=37700&view=rev Author: brlcad Date: 2010-02-21 18:08:39 +0000 (Sun, 21 Feb 2010) Log Message: ----------- move the doxygen comments into the header, clean them up, ws style formatting consistency on the rest. expand header prototypes to fix the strict compilation failure reported by nita budd (Sinclair). Modified Paths: -------------- brlcad/trunk/include/spm.h brlcad/trunk/src/libbn/sphmap.c Modified: brlcad/trunk/include/spm.h =================================================================== --- brlcad/trunk/include/spm.h 2010-02-21 02:28:40 UTC (rev 37699) +++ brlcad/trunk/include/spm.h 2010-02-21 18:08:39 UTC (rev 37700) @@ -21,8 +21,8 @@ /** @{ */ /** @file spm.h * - * @brief - * Sphere data structure and function declarations. + * @brief Sphere data structure and function declarations. Provides + * spherical data structures for texture mapping. * */ @@ -30,48 +30,131 @@ #define __SPM_H__ #ifndef BN_EXPORT -# if defined(_WIN32) && !defined(__CYGWIN__) && defined(BRLCAD_DLL) -# ifdef BN_EXPORT_DLL -# define BN_EXPORT __declspec(dllexport) -# else -# define BN_EXPORT __declspec(dllimport) -# endif -# else -# define BN_EXPORT -# endif +# if defined(_WIN32) && !defined(__CYGWIN__) && defined(BRLCAD_DLL) +# ifdef BN_EXPORT_DLL +# define BN_EXPORT __declspec(dllexport) +# else +# define BN_EXPORT __declspec(dllimport) +# endif +# else +# define BN_EXPORT +# endif #endif /* FIXME: These should all have bn_ prefixes */ -typedef struct { +typedef struct { unsigned long magic; - int ny; /**< @brief Number of "y" bins */ - int *nx; /**< @brief Number of "x" bins per "y" bin */ - int elsize; /**< @brief Size of each bin element */ - unsigned char **xbin; /**< @brief staring addresses of "x" bins */ - unsigned char *_data; /**< @brief For freeing purposes, start of data */ + int ny; /**< @brief Number of "y" bins */ + int *nx; /**< @brief Number of "x" bins per "y" bin */ + int elsize; /**< @brief Size of each bin element */ + unsigned char **xbin; /**< @brief staring addresses of "x" bins */ + unsigned char *_data; /**< @brief For freeing purposes, start of data */ } spm_map_t; -#define SPM_NULL (spm_map_t *)0 +#define SPM_NULL (spm_map_t *)0 -#define RT_CK_SPM(smp) BU_CKMAG(smp, SPM_MAGIC, "spm_map_t" ) -#define BN_CK_SPM(smp) BU_CKMAG(smp, SPM_MAGIC, "spm_map_t" ) +#define RT_CK_SPM(smp) BU_CKMAG(smp, SPM_MAGIC, "spm_map_t") +#define BN_CK_SPM(smp) BU_CKMAG(smp, SPM_MAGIC, "spm_map_t") -BN_EXPORT extern spm_map_t *spm_init(); -BN_EXPORT extern void spm_free(); -BN_EXPORT extern void spm_read(); -BN_EXPORT extern void spm_write(); -BN_EXPORT extern char *spm_get(); -BN_EXPORT extern int spm_load(); -BN_EXPORT extern int spm_save(); -BN_EXPORT extern int spm_pix_load(); -BN_EXPORT extern int spm_pix_save(); -BN_EXPORT extern void spm_dump(); -/*----------------------------------------------------------------------*/ -/* sphmap.c */ -BN_EXPORT extern int spm_px_load( spm_map_t *mapp, char *filename, int nx, int ny); +/** + * S P M _ I N I T + *@brief + * Return a sphere map structure initialized for N points around the + * equator. + * + * Malloc the storage and fill in the pointers. This code leaves a + * ring of "triangular" pixels at the poles. An alternative would be + * to have the pole region map to a single pixel. + * + * Returns SPM_NULL on error. + */ +BN_EXPORT extern spm_map_t *spm_init(int N, int elsize); +/** + * S P M _ F R E E + *@brief + * Free the storage associated with a sphere structure. + */ +BN_EXPORT extern void spm_free(spm_map_t *mp); + +/** + * S P M _ R E A D + *@brief + * Read the value of the pixel at the given normalized (u, v) + * coordinates. It does NOT check the sanity of the coords. + * + *@n 0.0 <= u < 1.0 Left to Right + *@n 0.0 <= v < 1.0 Bottom to Top + */ +BN_EXPORT extern void spm_read(register spm_map_t *mapp, register unsigned char *valp, double u, double v); + +/** + * S P M _ W R I T E + *@brief + * Write the value of the pixel at the given normalized (u, v) + * coordinates. It does NOT check the sanity of the coords. + * + *@n 0.0 <= u < 1.0 Left to Right + *@n 0.0 <= v < 1.0 Bottom to Top + */ +BN_EXPORT extern void spm_write(register spm_map_t *mapp, register unsigned char *valp, double u, double v); + +/** + * S P M _ G E T + *@brief + * Return a pointer to the storage element indexed by (u, v) + * coordinates. It does NOT check the sanity of the coords. + * + *@n 0.0 <= u < 1.0 Left to Right + *@n 0.0 <= v < 1.0 Bottom to Top + */ +BN_EXPORT extern char *spm_get(register spm_map_t *mapp, double u, double v); + +/** + * S P M _ L O A D + *@brief + * Read a saved sphere map from a file ("-" for stdin) into the given + * map structure. This does not check for conformity of size, etc. + * + * @return -1 on error, else 0. + */ +BN_EXPORT extern int spm_load(spm_map_t *mapp, char *filename); + +/** + * S P M _ S A V E + *@brief + * Write a loaded sphere map to the given file ("-" for stdout). + * Returns -1 on error, else 0. + */ +BN_EXPORT extern int spm_save(spm_map_t *mapp, char *filename); + +/** + * S P M _ P I X _ L O A D + *@brief + * Load an 'nx' by 'ny' pix file and filter it into the + * given sphere structure. + * + * @return -1 on error, else 0. + */ +BN_EXPORT extern int spm_pix_load(spm_map_t *mapp, char *filename, int nx, int ny); + +/** + * S P M _ P I X _ S A V E + *@brief + * Save a sphere structure as an 'nx' by 'ny' pix file. + * @return -1 on error, else 0. + */ +BN_EXPORT extern int spm_pix_save(spm_map_t *mapp, char *filename, int nx, int ny); + +/** + * S P M _ D U M P + *@brief + * Display a sphere structure on stderr. Used for debugging. + */ +BN_EXPORT extern void spm_dump(spm_map_t *mp, int verbose); + #endif /* __SPM_H__ */ /** @} */ Modified: brlcad/trunk/src/libbn/sphmap.c =================================================================== --- brlcad/trunk/src/libbn/sphmap.c 2010-02-21 02:28:40 UTC (rev 37699) +++ brlcad/trunk/src/libbn/sphmap.c 2010-02-21 18:08:39 UTC (rev 37700) @@ -17,14 +17,6 @@ * License along with this file; see the file named COPYING for more * information. */ -/** @addtogroup sphmap */ -/** @{ */ -/** @file sphmap.c - * - * @brief Common Subroutines for Spherical Data Structures/Texture - * Maps Subroutines - * - */ #include "common.h" @@ -37,113 +29,89 @@ #include "bn.h" #include "spm.h" -/** - * S P M _ I N I T - *@brief - * Return a sphere map structure initialized for N points around - * the equator. - * - * Malloc the storage and fill in the pointers. - * This code leaves a ring of "triangular" pixels at the poles. - * An alternative would be to have the pole region map to a - * single pixel. - * - * Returns SPM_NULL on error. - */ + spm_map_t * spm_init(int N, int elsize) { - int i, nx, total, idx; + int i, nx, total, idx; register spm_map_t *mapp; - mapp = (spm_map_t *)bu_malloc( sizeof(spm_map_t), "spm_map_t"); - if ( mapp == SPM_NULL ) - return( SPM_NULL ); + mapp = (spm_map_t *)bu_malloc(sizeof(spm_map_t), "spm_map_t"); + if (mapp == SPM_NULL) + return(SPM_NULL); memset((char *)mapp, 0, sizeof(spm_map_t)); mapp->elsize = elsize; mapp->ny = N/2; - mapp->nx = (int *) bu_malloc( (unsigned)(N/2 * sizeof(*(mapp->nx))), "sph nx" ); - if ( mapp->nx == NULL ) { - spm_free( mapp ); - return( SPM_NULL ); + mapp->nx = (int *) bu_malloc((unsigned)(N/2 * sizeof(*(mapp->nx))), "sph nx"); + if (mapp->nx == NULL) { + spm_free(mapp); + return(SPM_NULL); } - mapp->xbin = (unsigned char **) bu_malloc( (unsigned)(N/2 * sizeof(char *)), "sph xbin" ); - if ( mapp->xbin == NULL ) { - spm_free( mapp ); - return( SPM_NULL ); + mapp->xbin = (unsigned char **) bu_malloc((unsigned)(N/2 * sizeof(char *)), "sph xbin"); + if (mapp->xbin == NULL) { + spm_free(mapp); + return(SPM_NULL); } total = 0; - for ( i = 0; i < N/4; i++ ) { - nx = ceil( N*cos( i*bn_twopi/N ) ); - if ( nx > N ) nx = N; + for (i = 0; i < N/4; i++) { + nx = ceil(N*cos(i*bn_twopi/N)); + if (nx > N) nx = N; mapp->nx[ N/4 + i ] = nx; mapp->nx[ N/4 - i -1 ] = nx; total += 2*nx; } - mapp->_data = (unsigned char *) bu_calloc( (unsigned)total, elsize, "spm_init data" ); - if ( mapp->_data == NULL ) { - spm_free( mapp ); - return( SPM_NULL ); + mapp->_data = (unsigned char *) bu_calloc((unsigned)total, elsize, "spm_init data"); + if (mapp->_data == NULL) { + spm_free(mapp); + return(SPM_NULL); } idx = 0; - for ( i = 0; i < N/2; i++ ) { + for (i = 0; i < N/2; i++) { mapp->xbin[i] = &((mapp->_data)[idx]); idx += elsize * mapp->nx[i]; } mapp->magic = SPM_MAGIC; - return( mapp ); + return(mapp); } -/** - * S P M _ F R E E - *@brief - * Free the storage associated with a sphere structure. - */ + void spm_free(spm_map_t *mp) { RT_CK_SPM(mp); - if ( mp == SPM_NULL ) + if (mp == SPM_NULL) return; - if ( mp->_data != NULL ) { - (void) bu_free( (char *)mp->_data, "sph _data" ); + if (mp->_data != NULL) { + (void) bu_free((char *)mp->_data, "sph _data"); mp->_data = NULL; } - if ( mp->nx != NULL ) { - (void) bu_free( (char *)mp->nx, "sph nx" ); + if (mp->nx != NULL) { + (void) bu_free((char *)mp->nx, "sph nx"); mp->nx = NULL; } - if ( mp->xbin != NULL ) { - (void) bu_free( (char *)mp->xbin, "sph xbin" ); + if (mp->xbin != NULL) { + (void) bu_free((char *)mp->xbin, "sph xbin"); mp->xbin = NULL; } - (void) bu_free( (char *)mp, "spm_map_t" ); + (void) bu_free((char *)mp, "spm_map_t"); } -/* - * S P M _ R E A D - *@brief - * Read the value of the pixel at the given normalized (u, v) - * coordinates. It does NOT check the sanity of the coords. - * - *@n 0.0 <= u < 1.0 Left to Right - *@n 0.0 <= v < 1.0 Bottom to Top - */ + void spm_read(register spm_map_t *mapp, register unsigned char *valp, double u, double v) { - int x, y; + int x, y; register unsigned char *cp; - register int i; + register int i; RT_CK_SPM(mapp); @@ -152,26 +120,18 @@ cp = &(mapp->xbin[y][x*mapp->elsize]); i = mapp->elsize; - while ( i-- > 0 ) { + while (i-- > 0) { *valp++ = *cp++; } } -/* - * S P M _ W R I T E - *@breif - * Write the value of the pixel at the given normalized (u, v) - * coordinates. It does NOT check the sanity of the coords. - * - *@n 0.0 <= u < 1.0 Left to Right - *@n 0.0 <= v < 1.0 Bottom to Top - */ + void spm_write(register spm_map_t *mapp, register unsigned char *valp, double u, double v) { - int x, y; + int x, y; register unsigned char *cp; - register int i; + register int i; RT_CK_SPM(mapp); @@ -180,24 +140,16 @@ cp = &(mapp->xbin[y][x*mapp->elsize]); i = mapp->elsize; - while ( i-- > 0 ) { + while (i-- > 0) { *cp++ = *valp++; } } -/* - * S P M _ G E T - *@brief - * Return a pointer to the storage element indexed by (u, v) - * coordinates. It does NOT check the sanity of the coords. - * - *@n 0.0 <= u < 1.0 Left to Right - *@n 0.0 <= v < 1.0 Bottom to Top - */ + char * spm_get(register spm_map_t *mapp, double u, double v) { - int x, y; + int x, y; register unsigned char *cp; RT_CK_SPM(mapp); @@ -206,153 +158,134 @@ x = u * mapp->nx[y]; cp = &(mapp->xbin[y][x*mapp->elsize]); - return( (char *)cp ); + return((char *)cp); } -/* - * S P M _ L O A D - *@brief - * Read a saved sphere map from a file ("-" for stdin) into - * the given map structure. - * This does not check for conformity of size, etc. - * - * @return -1 on error, else 0. - */ + int spm_load(spm_map_t *mapp, char *filename) { - int y, total; - FILE *fp; + int y, total; + FILE *fp; RT_CK_SPM(mapp); - if ( strcmp( filename, "-" ) == 0 ) + if (strcmp(filename, "-") == 0) fp = stdin; - else { - bu_semaphore_acquire( BU_SEM_SYSCALL ); /* lock */ - fp = fopen( filename, "rb" ); - bu_semaphore_release( BU_SEM_SYSCALL ); /* unlock */ - if ( fp == NULL ) - return( -1 ); + else { + bu_semaphore_acquire(BU_SEM_SYSCALL); /* lock */ + fp = fopen(filename, "rb"); + bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */ + if (fp == NULL) + return(-1); } total = 0; - for ( y = 0; y < mapp->ny; y++ ) + for (y = 0; y < mapp->ny; y++) total += mapp->nx[y]; - bu_semaphore_acquire( BU_SEM_SYSCALL ); /* lock */ - y = (int)fread( (char *)mapp->_data, mapp->elsize, total, fp ); /* res_syscall */ - (void) fclose( fp ); - bu_semaphore_release( BU_SEM_SYSCALL ); /* unlock */ + bu_semaphore_acquire(BU_SEM_SYSCALL); /* lock */ + y = (int)fread((char *)mapp->_data, mapp->elsize, total, fp); /* res_syscall */ + (void) fclose(fp); + bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */ - if ( y != total ) - return( -1 ); + if (y != total) + return(-1); - return( 0 ); + return(0); } -/* - * S P M _ S A V E - *@brief - * Write a loaded sphere map to the given file ("-" for stdout). - * Returns -1 on error, else 0. - */ + int spm_save(spm_map_t *mapp, char *filename) { - int i; - int got; - FILE *fp; + int i; + int got; + FILE *fp; RT_CK_SPM(mapp); - if ( strcmp( filename, "-" ) == 0 ) + if (strcmp(filename, "-") == 0) fp = stdout; - else { - bu_semaphore_acquire( BU_SEM_SYSCALL ); /* lock */ - fp = fopen( filename, "wb" ); /* res_syscall */ - bu_semaphore_release( BU_SEM_SYSCALL ); /* unlock */ - if ( fp == NULL ) - return( -1 ); + else { + bu_semaphore_acquire(BU_SEM_SYSCALL); /* lock */ + fp = fopen(filename, "wb"); /* res_syscall */ + bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */ + if (fp == NULL) + return(-1); } - for ( i = 0; i < mapp->ny; i++ ) { - bu_semaphore_acquire( BU_SEM_SYSCALL ); /* lock */ - got = (int)fwrite( (char *)mapp->xbin[i], mapp->elsize, /* res_syscall */ - mapp->nx[i], fp ); - bu_semaphore_release( BU_SEM_SYSCALL ); /* unlock */ - if ( got != mapp->nx[i] ) { + for (i = 0; i < mapp->ny; i++) { + bu_semaphore_acquire(BU_SEM_SYSCALL); /* lock */ + got = (int)fwrite((char *)mapp->xbin[i], mapp->elsize, /* res_syscall */ + mapp->nx[i], fp); + bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */ + if (got != mapp->nx[i]) { bu_log("spm_save(%s): write error\n", filename); - bu_semaphore_acquire( BU_SEM_SYSCALL ); /* lock */ - (void) fclose( fp ); - bu_semaphore_release( BU_SEM_SYSCALL ); /* unlock */ - return( -1 ); + bu_semaphore_acquire(BU_SEM_SYSCALL); /* lock */ + (void) fclose(fp); + bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */ + return(-1); } } - bu_semaphore_acquire( BU_SEM_SYSCALL ); /* lock */ - (void) fclose( fp ); - bu_semaphore_release( BU_SEM_SYSCALL ); /* unlock */ + bu_semaphore_acquire(BU_SEM_SYSCALL); /* lock */ + (void) fclose(fp); + bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */ - return( 0 ); + return(0); } -/* - * S P M _ P I X _ L O A D - *@brief - * Load an 'nx' by 'ny' pix file and filter it into the - * given sphere structure. - * @return -1 on error, else 0. - */ + int -spm_px_load(spm_map_t *mapp, char *filename, int nx, int ny) +spm_pix_load(spm_map_t *mapp, char *filename, int nx, int ny) { - int i, j; /* index input file */ - int x, y; /* index texture map */ - double j_per_y, i_per_x; /* ratios */ - int nj, ni; /* ints of ratios */ + int i, j; /* index input file */ + int x, y; /* index texture map */ + double j_per_y, i_per_x; /* ratios */ + int nj, ni; /* ints of ratios */ unsigned char *cp; unsigned char *buffer; - unsigned long red, green, blue; - long count; - FILE *fp; + unsigned long red, green, blue; + long count; + FILE *fp; RT_CK_SPM(mapp); - if ( strcmp( filename, "-" ) == 0 ) + if (strcmp(filename, "-") == 0) fp = stdin; - else { - bu_semaphore_acquire( BU_SEM_SYSCALL ); /* lock */ - fp = fopen( filename, "rb" ); - bu_semaphore_release( BU_SEM_SYSCALL ); /* unlock */ - if ( fp == NULL ) - return( -1 ); + else { + bu_semaphore_acquire(BU_SEM_SYSCALL); /* lock */ + fp = fopen(filename, "rb"); + bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */ + if (fp == NULL) + return(-1); } /* Shamelessly suck it all in */ - buffer = (unsigned char *)bu_malloc( (unsigned)(nx*nx*3), "spm_px_load buffer" ); - bu_semaphore_acquire( BU_SEM_SYSCALL ); /* lock */ - i = (int)fread( (char *)buffer, 3, nx*ny, fp ); /* res_syscall */ - (void) fclose( fp ); - bu_semaphore_release( BU_SEM_SYSCALL ); /* unlock */ - if ( i != nx*ny ) { - bu_log("spm_px_load(%s) read error\n", filename); - return( -1 ); + buffer = (unsigned char *)bu_malloc((unsigned)(nx*nx*3), "spm_pix_load buffer"); + bu_semaphore_acquire(BU_SEM_SYSCALL); /* lock */ + i = (int)fread((char *)buffer, 3, nx*ny, fp); /* res_syscall */ + (void)fclose(fp); + bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */ + if (i != nx*ny) { + bu_log("spm_pix_load(%s) read error\n", filename); + return(-1); } j_per_y = (double)ny / (double)mapp->ny; nj = (int)j_per_y; /* for each bin */ - for ( y = 0; y < mapp->ny; y++ ) { + for (y = 0; y < mapp->ny; y++) { i_per_x = (double)nx / (double)mapp->nx[y]; ni = (int)i_per_x; /* for each cell in bin */ - for ( x = 0; x < mapp->nx[y]; x++ ) { + for (x = 0; x < mapp->nx[y]; x++) { /* Average pixels from the input file */ red = green = blue = 0; count = 0; - for ( j = y*j_per_y; j < y*j_per_y+nj; j++ ) { - for ( i = x*i_per_x; i < x*i_per_x+ni; i++ ) { + for (j = y*j_per_y; j < y*j_per_y+nj; j++) { + for (i = x*i_per_x; i < x*i_per_x+ni; i++) { red = red + (unsigned long)buffer[ 3*(j*nx+i) ]; green = green + (unsigned long)buffer[ 3*(j*nx+i)+1 ]; blue = blue + (unsigned long)buffer[ 3*(j*nx+i)+2 ]; @@ -366,83 +299,73 @@ *cp++ = (unsigned char)(blue/count); } } - (void) bu_free( (char *)buffer, "spm buffer" ); + (void) bu_free((char *)buffer, "spm buffer"); - return( 0 ); + return(0); } -/* - * S P M _ P I X _ S A V E - *@brief - * Save a sphere structure as an 'nx' by 'ny' pix file. - * @return -1 on error, else 0. - */ + int -spm_px_save(spm_map_t *mapp, char *filename, int nx, int ny) +spm_pix_save(spm_map_t *mapp, char *filename, int nx, int ny) { - int x, y; - FILE *fp; + int x, y; + FILE *fp; unsigned char pixel[3]; - int got; + int got; RT_CK_SPM(mapp); - if ( strcmp( filename, "-" ) == 0 ) + if (strcmp(filename, "-") == 0) fp = stdout; - else { - bu_semaphore_acquire( BU_SEM_SYSCALL ); /* lock */ - fp = fopen( filename, "wb" ); - bu_semaphore_release( BU_SEM_SYSCALL ); /* unlock */ - if ( fp == NULL ) - return( -1 ); + else { + bu_semaphore_acquire(BU_SEM_SYSCALL); /* lock */ + fp = fopen(filename, "wb"); + bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */ + if (fp == NULL) + return(-1); } - for ( y = 0; y < ny; y++ ) { - for ( x = 0; x < nx; x++ ) { - spm_read( mapp, pixel, (double)x/(double)nx, (double)y/(double)ny ); - bu_semaphore_acquire( BU_SEM_SYSCALL ); /* lock */ - got = (int)fwrite( (char *)pixel, sizeof(pixel), 1, fp ); /* res_syscall */ - bu_semaphore_release( BU_SEM_SYSCALL ); /* unlock */ - if ( got != 1 ) { + for (y = 0; y < ny; y++) { + for (x = 0; x < nx; x++) { + spm_read(mapp, pixel, (double)x/(double)nx, (double)y/(double)ny); + bu_semaphore_acquire(BU_SEM_SYSCALL); /* lock */ + got = (int)fwrite((char *)pixel, sizeof(pixel), 1, fp); /* res_syscall */ + bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */ + if (got != 1) { bu_log("spm_px_save(%s): write error\n", filename); - bu_semaphore_acquire( BU_SEM_SYSCALL ); /* lock */ - (void) fclose( fp ); - bu_semaphore_release( BU_SEM_SYSCALL ); /* unlock */ - return( -1 ); + bu_semaphore_acquire(BU_SEM_SYSCALL); /* lock */ + (void) fclose(fp); + bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */ + return(-1); } } } - bu_semaphore_acquire( BU_SEM_SYSCALL ); /* lock */ - (void) fclose( fp ); - bu_semaphore_release( BU_SEM_SYSCALL ); /* unlock */ + bu_semaphore_acquire(BU_SEM_SYSCALL); /* lock */ + (void) fclose(fp); + bu_semaphore_release(BU_SEM_SYSCALL); /* unlock */ - return( 0 ); + return(0); } -/* - * S P M _ D U M P - *@brief - * Display a sphere structure on stderr. - * Used for debugging. - */ + void spm_dump(spm_map_t *mp, int verbose) { - int i; + int i; RT_CK_SPM(mp); - bu_log("elsize = %d\n", mp->elsize ); - bu_log("ny = %d\n", mp->ny ); - bu_log("_data = %p\n", (void *)mp->_data ); - if ( !verbose ) return; - for ( i = 0; i < mp->ny; i++ ) { - bu_log(" nx[%d] = %3d, xbin[%d] = %p\n", - i, mp->nx[i], i, (void *)mp->xbin[i] ); + bu_log("elsize = %d\n", mp->elsize); + bu_log("ny = %d\n", mp->ny); + bu_log("_data = %p\n", (void *)mp->_data); + if (!verbose) return; + for (i = 0; i < mp->ny; i++) { + bu_log(" nx[%d] = %3d, xbin[%d] = %p\n", + i, mp->nx[i], i, (void *)mp->xbin[i]); } } -/** @} */ + /* * Local Variables: * mode: C This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |