home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 3 / RISC_DISC_3.iso / resources / etexts / gems / gemsiii / exttest / ehtest1.c next >
C/C++ Source or Header  |  1992-03-16  |  1KB  |  64 lines

  1. //
  2. // ExtHit minimal tester
  3. //
  4. // Len Wanger - Fri Aug 30 10:07:01 PDT 1991
  5. //
  6.  
  7. #include "iostream.h"
  8. #include "exthit.h"
  9.  
  10. void func_tst (Ptr data, Ptr p1, Ptr p2 )
  11. {
  12.   cout << "Objects " << (Ptr) p1 << " and " << (Ptr) p2 << " intersect.\n";
  13. }
  14.  
  15. main()
  16. {
  17.   ExtHit eh(5);
  18.   Extent ext;
  19.   Ptr ptr;
  20.  
  21.   ext.min[0] = 1; ext.max[0] = 3;
  22.   ext.min[1] = 2; ext.max[1] = 4;
  23.   ext.min[2] = 4; ext.max[2] = 6;
  24.   ext.min[3] = 2; ext.max[3] = 8;
  25.  
  26.   ptr = (Ptr) 0x1;
  27.  
  28.   if ( ! eh.add ( ext, ptr ) )
  29.     cout << "Fillnext failed\n";;
  30.  
  31.   ext.min[0] = 5; ext.max[0] = 7;
  32.   ext.min[1] = 6; ext.max[1] = 8;
  33.   ext.min[2] = 2; ext.max[2] = 8;
  34.   ext.min[3] = 1; ext.max[3] = 3;
  35.  
  36.   ptr = (Ptr) 0x2;
  37.  
  38.   if ( ! eh.add ( ext, ptr ) )
  39.     cout << "Fillnext failed\n";;
  40.  
  41.   ext.min[0] = 2; ext.max[0] = 6;
  42.   ext.min[1] = 3; ext.max[1] = 7;
  43.   ext.min[2] = 7; ext.max[2] = 7;
  44.   ext.min[3] = 2; ext.max[3] = 4;
  45.  
  46.   ptr = (Ptr) 0x3;
  47.  
  48.   if ( ! eh.add ( ext, ptr ) )
  49.     cout << "Fillnext failed\n";;
  50.  
  51.   ext.min[0] = 2; ext.max[0] = 6;
  52.   ext.min[1] = 5; ext.max[1] = 5;
  53.   ext.min[2] = 1; ext.max[2] = 5;
  54.   ext.min[3] = 1; ext.max[3] = 5;
  55.  
  56.   ptr = (Ptr) 0x4;
  57.  
  58.   if ( ! eh.add ( ext, ptr ) )
  59.     cout << "Fillnext failed\n";;
  60.  
  61.   eh.test ( func_tst, (Ptr) 0x5);
  62. }
  63.  
  64.