home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_07_06 / v7n6044b.txt < prev    next >
Text File  |  1989-07-25  |  896b  |  53 lines

  1. #include "math.h"
  2. #include "plot.h"
  3.  
  4. void settran(theta,phi)
  5. double theta,phi;
  6. {
  7. double ct,cp,st,sp;
  8. ct = cos(theta); st = sin(theta);
  9. cp = cos(phi); sp = sin(phi);
  10. m1 = ct; m2 = st;
  11. m3 = st*sp; m4 = ct*sp; m5 = cp;
  12. }
  13.  
  14. void initialmask (p,n)
  15. Gpoint *p;
  16. int n;
  17. {
  18. int i;
  19. /*
  20.  *    Initialize mask and mask size.
  21.  */
  22. for (i=0; i<n; i++) top[i] = bottom[i] = p[i];
  23. topn = bottomn = n;
  24. }
  25.  
  26. void transform (px,py,pz,p,n)
  27. double *px,*py,*pz;
  28. Gpoint *p;
  29. int n;
  30. {
  31. /*
  32.  *   Transform the (x,y,z) coordinates to (x",y") coords.
  33.  */
  34. int i;
  35. for (i=0; i<n; i++)
  36.   {
  37.     p[i].x = px[i]*m1 - py[i]*m2;
  38.     p[i].y = px[i]*m3 + py[i]*m4 + pz[i]*m5;
  39.   }
  40. }
  41.  
  42. int copyvec (a,b,n)
  43. Gpoint *a,*b;
  44. int n;
  45. {
  46. int i,k=1;
  47. b[0] = a[0];
  48. for (i=1; i<n; i++) 
  49.   if (b[i].x != b[i-1].x)
  50.     { b[i] = a[i]; k++; }
  51. return (k);
  52. }
  53.