|
|
Given a plane n * X = d with n the normal vector of the plane and d a constant. Furthermore given a ray X = P + t * D with P being the start- point of the ray, t >= 0 and D the direction vector of the ray. If the plane and the ray intersect then the distance is 0. In all other cases the minimum distance is the distance of the start-point of the ray to the plane which can simply be calculated as n * P - d. To determine a possible intersection point of the ray with the plane we must determine: n * (P + t * D) = d <==> n * P + t * N * D = d <==> t = (d - n * P) / (n * D) which yields a valid intersection point only for n * D != 0 and t >= 0. So to find out if the plane and the ray intersect we simply determine whether t >= 0 which is the same as (d - n * P) / (n * D) >= 0 <==> d >= n * P
|
Copyright © by Martin Ecker |