1

I am trying to determine if a point is inside an irregular cuboid: by "irregular", I mean that the 4 points that make up one face are not necessarily co-planar. I found these answers: point inside rectangular area and point inside 3D cuboid but they seem to involve cases where the points comprising a face are co-planar. I have tried the following methods:

  1. decompose the cuboid into its 5 constituent tetrahedra and check if the point is inisde any of the tetrahedra
  2. decompose the cuboid into a polyhedron consisting of 12 triangles (2 per face) and check if the point is inside the polyhedron
  3. as 2 but with 4 triangles per face, using the mid-point of the face as a common vertex to the 4 triangles
  4. compute the convex hull and check if the point is inside the convex hull
  5. fit planes through each of the faces and check if the point lies between all 3 pairs of planes.

Unfortunately, I have some degenerate cases (illustrated below) for which none of these methods work: the colours represent either the tetrahedra or triangles used in methods 1 and 2. enter image description here

For methods 1 and 2, the answer depends on which set of tetrahedra/triangles I choose: point P is inside the using the LH set of triangle/tetrahedra in the figure but outside using the RH set. There appear to be similar issues with the convex hull method, illustrated (not very well - apologies) by the dotted lines in the cross-sections. Method 3 does not work when the mid-point of (eg) the upper face is "deeper" than the mid-point of the lower face. Method 5 sometimes does not work in cases where the 4 vertices are not co-planar.

I am struggling with the concept of "inside" for some cases where the cuboid is highly distorted, which doesn't help with the question "point in cuboid" so any help would be greatly appreciated. Thanks!

  • To say if a point is on either side of a quadrilateral face, that face must be planar. Otherwise different choices will lead to different answers, as you discovered by yourself. – Intelligenti pauca Jul 23 '22 at 18:31
  • Thanks - I guess that makes sense. I was wondering if might be a way of representing the surface using 4 points in a non-planar form. A sphere is possible but I had in mind something like a rubber sheet stretched over the points, with some type of tensioning – PetGriffin Jul 26 '22 at 10:10
  • You could try with a bilinear interpolation: $$P=A + (B-A) s + (D-A) t +(C+A-B-D) st,\quad 0\le s\le1,\ 0\le t\le1.$$ – Intelligenti pauca Jul 26 '22 at 13:11
  • Does this work when the vertex angles (eg DAB) are not right angles? – PetGriffin Jul 28 '22 at 07:36
  • Yes, of course. You must only take care that $A$ and $C$ be opposite vertices. – Intelligenti pauca Jul 28 '22 at 08:32
  • OK thanks! Found this link https://stackoverflow.com/questions/23920976/bilinear-interpolation-with-non-aligned-input-points which gives s and t – PetGriffin Jul 28 '22 at 14:47

0 Answers0