|
|
Given an oriented box with center C, orthonormal axes U0, U1, U2, and extents E = (e0, e1, e2) along each axis. Let the point be written as P = C + s0*U0 + s1*U1 + s2*U2. Solving for the coefficients s = (s0, s1, s2) yields s0 = U0.(P - C) s1 = U1.(P - C) s2 = U2.(P - C) Depending on the values of s relative to the parameter space [-e0/2, e0/2] x [-e1/2, e1/2] x [-e2/2, e2/2] the closest point is either P itself, or a face point, an edge point or a vertex of the box. To determine that point, for each pair of parallel faces of the box, it must be determined which of the two faces is closest to P.
|
Copyright © by Martin Ecker |