src/shpnt.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: shpnt.c,v 1.2 2006/08/17 19:28:17 mhender Exp $";
00018 
00019 #include <shInternal.h>
00020 
00028 void shpnt(float *x,float *y,float *z)
00029  {
00030 
00031 /*     Shade and Render a point. */
00032 
00033   float s=0.;
00034   float t=0.;
00035   float d=0.;
00036   int clipped;
00037   int ip;
00038   float direc;
00039   int ipix,jpix;
00040   float zbuf=0.;
00041 
00042 /*     clip */
00043 
00044   clipped=0;
00045   if(sh_nplns>0)
00046    {
00047     for(ip==0;ip<sh_nplns;ip++)
00048      {
00049       direc=sh_plnn[  3*ip]*((*x)-sh_plno[  3*ip])+sh_plnn[1+3*ip]*((*y)-sh_plno[1+3*ip])+sh_plnn[2+3*ip]*((*z)-sh_plno[2+3*ip]);
00050       if(sh_oper[ip]==0)
00051         clipped=clipped||(sh_ipln[ip]*direc==0);
00052        else
00053         clipped=clipped&&(sh_ipln[ip]*direc==0);
00054      }
00055     if(clipped)return;
00056    }
00057 
00058   shpers(x,y,z,&s,&t,&d);
00059   ipix=s*shMax+.5;
00060   jpix=t*shMax+.5;
00061   if(ipix>0&&ipix<shIMax&&jpix>0&&jpix<shJMax)
00062    {
00063     shgetz(&ipix,&jpix,&zbuf);
00064     if(zbuf>d)shsetp(&ipix,&jpix,&sh_rp,&sh_gp,&sh_bp,&d);
00065    }
00066 
00067   return;
00068  }

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