Euclidean Geometry – How to Test if a Point is Inside a 3D Cuboid

3deuclidean-geometry

I have a cuboid in 3D space, it is not regular at all.
I do have the coordinates of its 8 vertices and my problem is how to determine a given point coordinate is inside or outside this cuboid.

I have so far though that if I can calculate the distance of the point to each of the 6 side planes then I can find out the answer.
Assume I can calculate for each side the plane formula with the normal pointing out of the cuboid, then for the point to be inside all distances must be negative, right? If one of the 6 distances is positive then the point is on the outside.

Is this the shortest and simplest approach?

Best Answer

If you express the cuboid as $C=\cap_{k=1}^6 H_k$, where each $H_k = \{ x | \langle x, n_k \rangle \le \beta_k \}$, then $ x \in C$ iff $\langle x, n_k \rangle \le \beta_k$ for all $k$.

You also have $ x \in C^\circ$ iff $\langle x, n_k \rangle < \beta_k$ for all $k$.

(It is hard to say if this is the shortest or simplest without more information. The eight vertices or the normals may have some relationship, for example.)

Related Question