home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / src / lib / gprim / inst / instbound.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-11  |  1.1 KB  |  45 lines

  1. /* Copyright (c) 1992 The Geometry Center; University of Minnesota
  2.    1300 South Second Street;  Minneapolis, MN  55454, USA;
  3.    
  4. This file is part of geomview/OOGL. geomview/OOGL is free software;
  5. you can redistribute it and/or modify it only under the terms given in
  6. the file COPYING, which you should have received along with this file.
  7. This and other related software may be obtained via anonymous ftp from
  8. geom.umn.edu; email: software@geom.umn.edu. */
  9.  
  10. /* Authors: Charlie Gunn, Stuart Levy, Tamara Munzner, Mark Phillips */
  11.  
  12. /*
  13.  * Compute bounding box of an Inst
  14.  */
  15. #include "instP.h"
  16.  
  17. BBox *
  18. InstBound( inst, T )
  19.     register Inst *inst;
  20.     Transform T;
  21. {
  22.     register BBox *geombbox;
  23.     Transform Tnew;
  24.     GeomIter *it;
  25.  
  26.     if( inst == NULL || inst->geom == NULL)
  27.     return NULL;
  28.  
  29.     it = GeomIterate( (Geom *)inst, DEEP );
  30.     geombbox = NULL;
  31.     while(NextTransform(it, Tnew) > 0) {
  32.     register BBox *box;
  33.  
  34.     TmConcat( Tnew, T, Tnew );
  35.     if((box = (BBox *)GeomBound( inst->geom, Tnew )) != NULL) {
  36.         if(geombbox) {
  37.         BBoxUnion3(geombbox, box, geombbox);
  38.         GeomDelete((Geom *)box);
  39.         } else
  40.         geombbox = box;
  41.     }
  42.     }
  43.     return geombbox;
  44. }
  45.