28 |
|
#include "tmesh.h" |
29 |
|
|
30 |
|
|
31 |
< |
#define EDGE_CACHE_SIZ 109 /* length of mesh edge cache */ |
31 |
> |
#define EDGE_CACHE_SIZ 251 /* length of mesh edge cache */ |
32 |
|
|
33 |
|
#define curmi (edge_cache.mi) |
34 |
|
#define curmsh (curmi->msh) |
68 |
|
int4 t = v2; v2 = v1; v1 = t; |
69 |
|
reversed = 1; |
70 |
|
} |
71 |
< |
ecp = &edge_cache.cache[(v2<<11 ^ v1) % EDGE_CACHE_SIZ]; |
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 |
|
double vol; |
75 |
|
if (!getmeshvert(&tv1, edge_cache.mi->msh, v1, MT_V) || |
76 |
< |
!getmeshvert(&tv2, edge_cache.mi->msh, v2, MT_V)) |
76 |
> |
!getmeshvert(&tv2, edge_cache.mi->msh, v2, MT_V)) |
77 |
|
objerror(edge_cache.o, INTERNAL, |
78 |
< |
"missing mesh vertex in signed_volume"); |
78 |
> |
"missing mesh vertex in signed_volume"); |
79 |
|
vol = (tv1.v[0] - r->rorg[0]) * |
80 |
|
( (tv2.v[1] - r->rorg[1])*r->rdir[2] - |
81 |
|
(tv2.v[2] - r->rorg[2])*r->rdir[1] ); |
113 |
|
for (i = oset[0]; i > 0; i--) { |
114 |
|
if (!getmeshtrivid(tvi, curmsh, oset[i])) |
115 |
|
objerror(edge_cache.o, INTERNAL, |
116 |
< |
"missing triangle vertices in mesh_hit"); |
116 |
> |
"missing triangle vertices in mesh_hit"); |
117 |
|
sv1 = signed_volume(r, tvi[0], tvi[1]); |
118 |
|
sv2 = signed_volume(r, tvi[1], tvi[2]); |
119 |
|
sv3 = signed_volume(r, tvi[2], tvi[0]); |
139 |
|
r->rot = d; |
140 |
|
VSUM(r->rop, r->rorg, r->rdir, d); |
141 |
|
VCOPY(r->ron, nrm); |
142 |
< |
/* normalize(r->ron) called in o_mesh() & rod set */ |
142 |
> |
/* normalize(r->ron) called & r->rod set in o_mesh() */ |
143 |
|
} |
144 |
|
} |
145 |
|
|