home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / gfx / 3d / irit / docs / cexample / polyarea.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-03  |  852 b   |  39 lines

  1. #include "irit_sm.h"
  2. #include "iritprsr.h"
  3. #include "allocate.h"
  4. #include "geomvals.h"
  5.  
  6. void main(int argc, char **argv)
  7. {
  8.     int Handler;
  9.  
  10.     if (argc == 2) {
  11.     if ((Handler = IritPrsrOpenDataFile(argv[1], TRUE, TRUE)) >= 0) {
  12.         IPObjectStruct
  13.         *PObj = IritPrsrGetObjects(Handler);
  14.  
  15.         /* Done with file - close it. */
  16.         IritPrsrCloseStream(Handler, TRUE);
  17.  
  18.         /* Process the geometry - compute the accumulated area. */
  19.         if (IP_IS_POLY_OBJ(PObj) && IP_IS_POLYGON_OBJ(PObj))
  20.         fprintf(stderr, "Area of polyhedra is %lf\n",
  21.             PolyObjectArea(PObj));
  22.         else
  23.             fprintf(stderr, "Read object is not a polyhedra.\n");
  24.  
  25.         IPFreeObject(PObj);
  26.     }
  27.     else {
  28.         fprintf(stderr, "Failed to open file \"%s\"\n", argv[1]);
  29.         exit(1);
  30.     }
  31.     }
  32.     else {
  33.     fprintf(stderr, "Usage: PolyArea geom.dat\n");
  34.     exit(2);
  35.     }
  36.  
  37.     exit(0);
  38. }
  39.