src/sh3dmask.c

00001 
00006 /*
00007  *  PROGRAM NAME:  sh
00008  *
00009  *  (c) COPYRIGHT INTERNATIONAL BUSINESS MACHINES
00010  *  CORPORATION 12/1/2001.  ALL RIGHTS RESERVED.
00011  *
00012  *  Please refer to the LICENSE file in the top directory
00013  *
00014  *      author: Mike Henderson mhender@watson.ibm.com
00015  */
00016 
00017 static char *id="@(#) $Id: sh3dmask.c,v 1.2 2006/08/17 19:28:17 mhender Exp $";
00018 
00019 #include <shInternal.h>
00020 #include <math.h>
00021 
00031 void sh3dmask(float *x,float *y,float *z,float *nrm,int *imask)
00032  {
00033   int cx,cy,cz;
00034   float tx,ty,tz;
00035   int n;
00036 
00037   n=5;
00038 
00039   tx=(*x)*n-floor((*x)*n);
00040   ty=(*y)*n-floor((*y)*n);
00041   tz=(*z)*n-floor((*z)*n);
00042   if(tx<0)tx=tx+1.;
00043   if(ty<0)ty=ty+1.;
00044   if(tz<0)tz=tz+1.;
00045 
00046   cx=fabs(tx-.5)<.4;
00047   cy=fabs(ty-.5)<.4;
00048   cz=fabs(tz-.5)<.4;
00049 
00050   *imask=0;
00051   if(!cx&&fabs(nrm[0])<.9)*imask=1;
00052   if(!cy&&fabs(nrm[1])<.9)*imask=1;
00053   if(!cz&&fabs(nrm[2])<.9)*imask=1;
00054 
00055   return;
00056  }

Generated on Thu Aug 17 15:29:43 2006 for sh by  doxygen 1.4.6