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

Comparing ray/src/rt/o_mesh.c (file contents):
Revision 2.2 by greg, Tue Mar 11 22:48:20 2003 UTC vs.
Revision 2.4 by greg, Wed Mar 12 17:26:58 2003 UTC

# Line 71 | Line 71 | int4           v1, v2;
71          ecp = &edge_cache.cache[((v2<<11 ^ v1) & 0x7fffffff) % EDGE_CACHE_SIZ];
72          if (ecp->v1i != v1 || ecp->v2i != v2) {
73                  MESHVERT        tv1, tv2;       /* compute signed volume */
74 +                FVECT           v2d;
75                  double          vol;
76                  if (!getmeshvert(&tv1, edge_cache.mi->msh, v1, MT_V) ||
77                              !getmeshvert(&tv2, edge_cache.mi->msh, v2, MT_V))
78                          objerror(edge_cache.o, INTERNAL,
79                                  "missing mesh vertex in signed_volume");
80 +                VSUB(v2d, tv2.v, r->rorg);
81                  vol = (tv1.v[0] - r->rorg[0]) *
82 <                                ( (tv2.v[1] - r->rorg[1])*r->rdir[2] -
81 <                                  (tv2.v[2] - r->rorg[2])*r->rdir[1] );
82 >                                (v2d[1]*r->rdir[2] - v2d[2]*r->rdir[1]);
83                  vol += (tv1.v[1] - r->rorg[1]) *
84 <                                ( (tv2.v[2] - r->rorg[2])*r->rdir[0] -
84 <                                  (tv2.v[0] - r->rorg[0])*r->rdir[2] );
84 >                                (v2d[2]*r->rdir[0] - v2d[0]*r->rdir[2]);
85                  vol += (tv1.v[2] - r->rorg[2]) *
86 <                                ( (tv2.v[0] - r->rorg[0])*r->rdir[1] -
87 <                                  (tv2.v[1] - r->rorg[1])*r->rdir[0] );
86 >                                (v2d[0]*r->rdir[1] - v2d[1]*r->rdir[0]);
87                  if (vol > .0)
88                          ecp->signum = 1;
89                  else if (vol < .0)
# Line 197 | Line 196 | register RAY   *r;
196                  if (normalize(r->pert) != 0.0)
197                          for (i = 0; i < 3; i++)
198                                  r->pert[i] -= r->ron[i];
199 <        }
199 >        } else
200 >                r->pert[0] = r->pert[1] = r->pert[2] = .0;
201 >
202          if (flags & MT_UV)              /* interpolate uv coordinates */
203                  for (i = 0; i < 2; i++)
204                          r->uv[i] = wt[0]*tv[0].uv[i] +
205                                          wt[1]*tv[1].uv[i] +
206                                          wt[2]*tv[2].uv[i];
207 +        else
208 +                r->uv[0] = r->uv[1] = .0;
209  
210                                          /* return hit */
211          return(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines