| 1 | 
– | 
/* Copyright (c) 1987 Regents of the University of California */ | 
| 2 | 
– | 
 | 
| 1 | 
  | 
#ifndef lint | 
| 2 | 
< | 
static char SCCSid[] = "$SunId$ LBL"; | 
| 2 | 
> | 
static const char RCSid[] = "$Id$"; | 
| 3 | 
  | 
#endif | 
| 6 | 
– | 
 | 
| 4 | 
  | 
/* | 
| 5 | 
  | 
 *  bbox.c - routines for bounding box computation. | 
| 9 | 
– | 
 * | 
| 10 | 
– | 
 *      8/4/87 | 
| 6 | 
  | 
 */ | 
| 7 | 
  | 
 | 
| 8 | 
+ | 
#include  "copyright.h" | 
| 9 | 
+ | 
 | 
| 10 | 
  | 
#include  "standard.h" | 
| 11 | 
  | 
 | 
| 12 | 
  | 
#include  "object.h" | 
| 13 | 
  | 
 | 
| 14 | 
+ | 
#include  "octree.h" | 
| 15 | 
+ | 
 | 
| 16 | 
  | 
#include  "otypes.h" | 
| 17 | 
  | 
 | 
| 18 | 
  | 
#include  "face.h" | 
| 21 | 
  | 
 | 
| 22 | 
  | 
#include  "instance.h" | 
| 23 | 
  | 
 | 
| 24 | 
+ | 
#include  "mesh.h" | 
| 25 | 
  | 
 | 
| 26 | 
+ | 
 | 
| 27 | 
  | 
add2bbox(o, bbmin, bbmax)               /* expand bounding box to fit object */ | 
| 28 | 
  | 
register OBJREC  *o; | 
| 29 | 
  | 
FVECT  bbmin, bbmax; | 
| 31 | 
  | 
        CONE  *co; | 
| 32 | 
  | 
        FACE  *fo; | 
| 33 | 
  | 
        INSTANCE  *io; | 
| 34 | 
+ | 
        MESHINST  *mi; | 
| 35 | 
  | 
        FVECT  v; | 
| 36 | 
  | 
        register int  i, j; | 
| 37 | 
  | 
 | 
| 72 | 
  | 
                                if (j & 1<<i) | 
| 73 | 
  | 
                                        v[i] += io->obj->scube.cusize; | 
| 74 | 
  | 
                        } | 
| 75 | 
< | 
                        multp3(v, v, io->f.xfm); | 
| 75 | 
> | 
                        multp3(v, v, io->x.f.xfm); | 
| 76 | 
> | 
                        point2bbox(v, bbmin, bbmax); | 
| 77 | 
> | 
                } | 
| 78 | 
> | 
                break; | 
| 79 | 
> | 
        case OBJ_MESH: | 
| 80 | 
> | 
                mi = getmeshinst(o, IO_BOUNDS); | 
| 81 | 
> | 
                for (j = 0; j < 8; j++) { | 
| 82 | 
> | 
                        for (i = 0; i < 3; i++) { | 
| 83 | 
> | 
                                v[i] = mi->msh->mcube.cuorg[i]; | 
| 84 | 
> | 
                                if (j & 1<<i) | 
| 85 | 
> | 
                                        v[i] += mi->msh->mcube.cusize; | 
| 86 | 
> | 
                        } | 
| 87 | 
> | 
                        multp3(v, v, mi->x.f.xfm); | 
| 88 | 
  | 
                        point2bbox(v, bbmin, bbmax); | 
| 89 | 
  | 
                } | 
| 90 | 
  | 
                break; |