erebus

diff liberebus/src/geomobj.cc @ 43:ed18af9da8f7

first attempt at separating direct from indirect failed miserably
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 11 Jun 2014 16:38:11 +0300
parents 2e817711d0f6
children a2afaf8af09b
line diff
     1.1 --- a/liberebus/src/geomobj.cc	Tue Jun 10 16:15:08 2014 +0300
     1.2 +++ b/liberebus/src/geomobj.cc	Wed Jun 11 16:38:11 2014 +0300
     1.3 @@ -52,16 +52,16 @@
     1.4  	float c = dot_product(ray.origin, ray.origin) - 1.0;
     1.5  
     1.6  	float d = b * b - 4.0 * a * c;
     1.7 -	if(d < 1e-6) return false;
     1.8 +	if(d < 1e-5) return false;
     1.9  
    1.10  	float sqrt_d = sqrt(d);
    1.11  	float t0 = (-b + sqrt_d) / (2.0 * a);
    1.12  	float t1 = (-b - sqrt_d) / (2.0 * a);
    1.13  
    1.14 -	if(t0 < 1e-6) t0 = t1;
    1.15 -	if(t1 < 1e-6) t1 = t0;
    1.16 +	if(t0 < 1e-5) t0 = t1;
    1.17 +	if(t1 < 1e-5) t1 = t0;
    1.18  	float t = t0 < t1 ? t0 : t1;
    1.19 -	if(t < 1e-6) return false;
    1.20 +	if(t < 1e-5) return false;
    1.21  
    1.22  	if(hit) {
    1.23  		hit->dist = t;
    1.24 @@ -146,8 +146,8 @@
    1.25  		tmax = tzmax;
    1.26  	}
    1.27  
    1.28 -	float t = tmin < 1e-4 ? tmax : tmin;
    1.29 -	if(t >= 1e-4) {
    1.30 +	float t = tmin < 1e-5 ? tmax : tmin;
    1.31 +	if(t >= 1e-5) {
    1.32  		if(hit) {
    1.33  			hit->obj = this;
    1.34  			hit->dist = t;