intersectsPlane method
Performs a ray/plane intersection test. Returns either true or false if there is a intersection or not.
Implementation
bool intersectsPlane(Plane plane ) {
// check if the ray lies on the plane first
final distToPoint = plane.distanceToPoint( origin );
if ( distToPoint == 0 ) {
return true;
}
final denominator = plane.normal.dot( direction );
if ( denominator * distToPoint < 0 ) {
return true;
}
// ray origin is behind the plane (and is pointing behind it)
return false;
}