Here's what I have for the plane intersection test:
Code: Select all
double t;
...
t = (-ray.o.y) / ray.v.y;
if (t > Const.EPSILON && t < tMax) {
return new IntersectionState(this,t);
} else {
return null;
}
....
The above is just a test for a plane centred at <0,0,0> and with the normal pointing along the Y-axis (the ray will already have been transformed into the shape co-ordinate system before this code is called).
Probably the only change you need to make is to define an EPSILON somewhere and change....
Code: Select all
if (T <= 0) {
T = -1;
trueHit = false;
} else{
trueHit=true;
}
Code: Select all
if (T <= EPSILON) {
T = -1;
trueHit = false;
} else{
trueHit=true;
}

Ian.