Subversion Repositories gelsvn

Rev

Rev 299 | Rev 609 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 299 Rev 309
Line 13... Line 13...
13
	for(int i=0;i<3;++i)
13
	for(int i=0;i<3;++i)
14
		{
14
		{
15
			t0[i] = (pmin[i]-p[i])/dir[i];
15
			t0[i] = (pmin[i]-p[i])/dir[i];
16
			t1[i] = (pmax[i]-p[i])/dir[i];
16
			t1[i] = (pmax[i]-p[i])/dir[i];
17
		}
17
		}
-
 
18
	Vec3f tin = v_min(t0, t1);
-
 
19
	Vec3f tout = v_max(t0,t1);
18
	float tmin = max(min(t0[0],t1[0]),max(min(t0[1],t1[1]),min(t0[2],t1[2])));
20
	float tmin = max(tin[0], max(tin[1], tin[2]));
19
	float tmax = min(max(t0[0],t1[0]),min(max(t0[1],t1[1]),max(t0[2],t1[2])));
21
	float tmax = min(tout[0], min(tout[1], tout[2]));
20
 
22
 
21
	return ( (tmin + CGLA::TINY) <tmax);
23
	return ( (tmin-CGLA::TINY) < (tmax+CGLA::TINY));
22
}
24
}
23
 
25
 
24
void AABox::minmax_sq_dist(const CGLA::Vec3f& p, 
26
void AABox::minmax_sq_dist(const CGLA::Vec3f& p, 
25
													 float& dmin, float& dmax) const
27
													 float& dmin, float& dmax) const
26
{
28
{