ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/ot/o_instance.c
(Generate patch)

Comparing ray/src/ot/o_instance.c (file contents):
Revision 1.1 by greg, Thu Feb 2 10:33:04 1989 UTC vs.
Revision 1.7 by greg, Sat Jan 5 09:41:26 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1988 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 45 | Line 45 | o_instance(o, cu)                      /* determine if cubes intersect */
45   OBJREC  *o;
46   CUBE  *cu;
47   {
48 <        static char  vstart[4] = {0, 3, 5, 6};
48 >        static int  vstart[4] = {0, 3, 5, 6};
49          FVECT  cumin, cumax;
50          FVECT  vert[8];
51          FVECT  v1, v2;
# Line 53 | Line 53 | CUBE  *cu;
53          int  vloc, vout;
54          register int  i, j;
55                                          /* get octree arguments */
56 <        in = getinstance(o, GET_BOUNDS);
56 >        in = getinstance(o, IO_BOUNDS);
57                                          /* check if cube vertex in octree */
58          for (j = 0; j < 3; j++)
59                  cumax[j] = (cumin[j] = in->obj->scube.cuorg[j]) +
# Line 66 | Line 66 | CUBE  *cu;
66                          if (i & 1<<j)
67                                  v1[j] += cu->cusize;
68                  }
69 <                multp3(v2, v1, in->b.xfm);
69 >                multp3(v2, v1, in->x.b.xfm);
70                  if (j = plocate(v2, cumin, cumax))
71                          vout++;
72                  vloc &= j;
73          }
74          if (vout == 0)                  /* all inside */
75 <                return(2);
75 >                return(O_IN);
76          if (vout < 8)                   /* some inside */
77 <                return(1);
77 >                return(O_HIT);
78          if (vloc)                       /* all to one side */
79 <                return(0);
79 >                return(O_MISS);
80                                          /* octree vertices in cube? */
81          for (j = 0; j < 3; j++)
82                  cumax[j] = (cumin[j] = cu->cuorg[j]) + cu->cusize;
# Line 87 | Line 87 | CUBE  *cu;
87                          if (i & 1<<j)
88                                  v1[j] += in->obj->scube.cusize;
89                  }
90 <                multp3(vert[i], v1, in->f.xfm);
90 >                multp3(vert[i], v1, in->x.f.xfm);
91                  if (j = plocate(vert[i], cumin, cumax))
92                          vloc &= j;
93                  else
94 <                        return(1);      /* vertex inside */
94 >                        return(O_HIT);  /* vertex inside */
95          }
96          if (vloc)                       /* all to one side */
97 <                return(0);
97 >                return(O_MISS);
98                                          /* check edges */
99          for (i = 0; i < 4; i++)
100                  for (j = 0; j < 3; j++) {
# Line 102 | Line 102 | CUBE  *cu;
102                          VCOPY(v1, vert[vstart[i]]);
103                          VCOPY(v2, vert[vstart[i] ^ 1<<j]);
104                          if (clip(v1, v2, cumin, cumax))
105 <                                return(1);              /* edge inside */
105 >                                return(O_HIT);          /* edge inside */
106                  }
107  
108 <        return(0);                      /* no intersection */
108 >        return(O_MISS);                 /* no intersection */
109   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines