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

Comparing ray/src/hd/sm_stree.c (file contents):
Revision 3.6 by gwlarson, Tue Oct 6 18:18:54 1998 UTC vs.
Revision 3.7 by gwlarson, Wed Nov 11 12:05:41 1998 UTC

# Line 26 | Line 26 | extern int Pick_cnt;
26   FVECT stDefault_base[6] = {  {1.,0.,0.},{0.,1.,0.}, {0.,0.,1.},
27                              {-1.,0.,0.},{0.,-1.,0.},{0.,0.,-1.}};
28   /* octahedron triangle vertices */
29 < int stBase_verts[8][3] = { {0,1,2},{0,5,1},{3,1,5},{3,2,1},
30 <                          {0,2,4},{5,0,4},{5,4,3},{2,3,4}};
29 > int stBase_verts[8][3] = { {2,1,0},{1,5,0},{5,1,3},{1,2,3},
30 >                          {4,2,0},{4,0,5},{3,4,5},{4,3,2}};
31   /* octahedron triangle nbrs ; nbr i is the face opposite vertex i*/
32 < int stBase_nbrs[8][3] =  { {3,4,1},{2,0,5},{1,6,3},{0,2,7},
33 <                          {7,5,0},{4,6,1},{7,2,5},{6,4,3}};
32 > int stBase_nbrs[8][3] =  { {1,4,3},{5,0,2},{3,6,1},{7,2,0},
33 >                          {0,5,7},{1,6,4},{5,2,7},{3,4,6}};
34   /* look up table for octahedron point location */
35   int stlocatetbl[8] = {6,7,2,3,5,4,1,0};
36  
# Line 86 | Line 86 | STREE *st;
86        FP_X(ST_NTH_PLANE(st,i)) = (m+1)%3;
87        FP_Y(ST_NTH_PLANE(st,i)) = (m+2)%3;
88        FP_Z(ST_NTH_PLANE(st,i)) = m;
89 <      VCROSS(ST_EDGE_NORM(st,i,0),v1,v0);
90 <      VCROSS(ST_EDGE_NORM(st,i,1),v2,v1);
91 <      VCROSS(ST_EDGE_NORM(st,i,2),v0,v2);
89 >      VCROSS(ST_EDGE_NORM(st,i,0),v0,v1);
90 >      VCROSS(ST_EDGE_NORM(st,i,1),v1,v2);
91 >      VCROSS(ST_EDGE_NORM(st,i,2),v2,v0);
92    }
93    return(st);
94   }
# Line 211 | Line 211 | stTrace_ray(st,orig,dir,func,argptr)
211   {
212      int next,last,i,f=0;
213      QUADTREE root;
214 <    FVECT o,n;
215 <    double pd,t;
214 >    FVECT o,n,v;
215 >    double pd,t,d;
216  
217      VCOPY(o,orig);
218 <
218 > #ifdef TEST_DRIVER
219 >       Pick_cnt=0;
220 > #endif;
221      /* Find the root node that o falls in */
222      i = stPoint_in_root(o);
223      root = ST_NTH_ROOT(st,i);
# Line 226 | Line 228 | stTrace_ray(st,orig,dir,func,argptr)
228  
229      if(QT_FLAG_IS_DONE(f))
230        return(TRUE);
231 <        
231 >    
232 >    d = DOT(orig,dir)/sqrt(DOT(orig,orig));
233 >    VSUM(v,orig,dir,-d);
234      /* Crossed over to next cell: id = nbr */
235      while(1)
236        {
# Line 236 | Line 240 | stTrace_ray(st,orig,dir,func,argptr)
240             */
241          if(next == INVALID)
242            return(FALSE);
243 <        if(!intersect_ray_oplane(orig,dir,
244 <                                 ST_EDGE_NORM(st,i,(next+1)%3),NULL,o))
243 > #if 0
244 >        if(!intersect_ray_oplane(o,dir,ST_EDGE_NORM(st,i,(next+1)%3),NULL,o))
245 > #endif
246 >           if(DOT(o,v) < 0.0)
247             /* Ray does not cross into next cell: done and tri not found*/
248             return(FALSE);
249  
# Line 269 | Line 275 | stVisit_tri(st,t0,t1,t2,func,f,argptr)
275    FVECT n0,n1,n2;
276  
277    /* Calcuate the edge normals for tri */
278 <  VCROSS(n0,t1,t0);
279 <  VCROSS(n1,t2,t1);
280 <  VCROSS(n2,t0,t2);
278 >  VCROSS(n0,t0,t1);
279 >  VCROSS(n1,t1,t2);
280 >  VCROSS(n2,t2,t0);
281  
282    for(i=0; i < ST_NUM_ROOT_NODES; i++)
283    {
# Line 295 | Line 301 | stApply_to_tri(st,t0,t1,t2,edge_func,tri_func,argptr)
301   {
302      int f;
303      FVECT dir;
304 <    
304 >
305 > #ifdef TEST_DRIVER
306 >    Pick_cnt=0;
307 > #endif;
308    /* First add all of the leaf cells lying on the triangle perimeter:
309       mark all cells seen on the way
310     */
# Line 307 | Line 316 | stApply_to_tri(st,t0,t1,t2,edge_func,tri_func,argptr)
316      if(QT_FLAG_FILL_TRI(f) || QT_FLAG_UPDATE(f))
317         stVisit_tri(st,t0,t1,t2,tri_func,&f,argptr);
318   }
319 +
320 +
321 +
322 +
323  
324  
325  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines