(20111216) 01:00

This commit is contained in:
2011-12-16 01:00:00 +01:00
parent 0855d72749
commit f67911db62
16 changed files with 367 additions and 97 deletions

6
Util.c
View File

@@ -40,18 +40,18 @@ int Intersec_RayUnitCircle(vec2 orig,vec2 vel,vec2 center,float *t){
// Solve as a unit circle
a=vec2_dot(vel,vel);
if(fabs(a)<0.000001f){
if(fabs(a)<0.0f){
return(0);
}
vec2_minus(temp,orig,center);
b=2.0f*vec2_dot(temp,vel);
c=vec2_dot(temp,temp)-1.0f;
if(SolveQuadratic(a,b,c,&Rmin,&Rmax)){
if(Rmin>=-0.0001f && Rmin<Rmax && Rmin<=1.0f){
if(Rmin>=-0.0f && Rmin<Rmax && Rmin<=1.0f){
*t=Rmin;
return(1);
}
if(Rmax>=-0.0001f && Rmin>Rmax && Rmax<=1.0f){
if(Rmax>=-0.0f && Rmin>Rmax && Rmax<=1.0f){
*t=Rmax;
return(1);
}