src/shpln.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: shpln.c,v 1.2 2006/08/17 19:28:17 mhender Exp $";
00018 
00019 #include <shInternal.h>
00020 
00033 void shpln(int *i,float *ox,float *oy,float *oz,float *nx,float *ny,float *nz,int *iside)
00034  {
00035   int ip;
00036 
00037   ip=(*i)-1;
00038 
00039 /* Set the clipping plane info. */
00040 
00041   if(*i>=sh_mplns)
00042    {
00043     if(sh_mplns==0)
00044      {
00045       sh_mplns=10;
00046       sh_plno=(float*)malloc(3*sh_mplns*sizeof(float));
00047       sh_plnn=(float*)malloc(3*sh_mplns*sizeof(float));
00048       sh_ipln=(int*)malloc(sh_mplns*sizeof(int));
00049       sh_oper=(int*)malloc(sh_mplns*sizeof(int));
00050      }else{
00051       sh_mplns+=10;
00052       sh_plno=(float*)realloc((void*)sh_plno,3*sh_mplns*sizeof(float));
00053       sh_plnn=(float*)realloc((void*)sh_plnn,3*sh_mplns*sizeof(float));
00054       sh_ipln=(int*)realloc((void*)sh_ipln,sh_mplns*sizeof(int));
00055       sh_oper=(int*)realloc((void*)sh_oper,sh_mplns*sizeof(int));
00056      }
00057    }
00058 
00059   sh_plno[  3*ip]=*ox;
00060   sh_plno[1+3*ip]=*oy;
00061   sh_plno[2+3*ip]=*oz;
00062 
00063   sh_plnn[  3*ip]=*nx;
00064   sh_plnn[1+3*ip]=*ny;
00065   sh_plnn[2+3*ip]=*nz;
00066 
00067   sh_ipln[ip]=*iside;
00068   sh_oper[ip]=0;
00069 
00070 /*printf("plane %d is ((x,y,z)-(%f,%f,%f)).(%f,%f,%f)*%d>0\n",ip,sh_plno[  3*ip],sh_plno[1+3*ip],sh_plno[2+3*ip],sh_plnn[  3*ip],sh_plnn[1+3*ip],sh_plnn[2+3*ip],sh_ipln[ip]);fflush(stdout);*/
00071 
00072 
00073   return;
00074  }

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