9

Consider the situation in which I have a cuboid:

Cuboid[{0,0,0},{1,1,1}]

and a point in the cubiod

{0.9,0.4,0.6}

How do I find the distance from the closest surface of the cuboid?

mattiav27
  • 6,677
  • 3
  • 28
  • 64

1 Answers1

12

How about:

SignedRegionDistance[Cuboid[{0, 0, 0}, {1, 1, 1}], {0.9, 0.4, 0.6}]
-0.1

the negative sign tells you that the query point is inside the region.

user21
  • 39,710
  • 8
  • 110
  • 167