# Compute Minimal Distances

For a point and a region, you can compute the minimal distance to the region. The minimal distance is given by MinValue[ , ], where is the given point and is the region.

Curves where each point has minimal distance to the region of 0.25, 0.5, and 1.0.

 In:= Xdline = RegionDistance[Line[{{0, 0}, {1, 0}, {0, 1}}]]; dtri = RegionDistance[Triangle[{{0, 0}, {1, 0}, {0, 1}}]];
 In:= XTable[ContourPlot[df[{x, y}], {x, -2, 3}, {y, -2, 3}, Contours -> {0.25, 0.5, 1.0}, Exclusions -> None], {df, {dline, dtri}}]
 Out= Surfaces where each point has minimal distance to the region of 0.25, 0.5, and 1.0.

 In:= Xdline = RegionDistance[Line[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0.}}]]; dtri = RegionDistance[Triangle[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0.}}]]; dtet = RegionDistance[ Tetrahedron[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1.}}]];
 In:= XTable[ContourPlot3D[df[{x, y, z}], {x, -2, 3}, {y, -2, 3}, {z, -2, 3}, Mesh -> None, Contours -> {0.25, 0.5, 1.0}, PlotPoints -> 50, MaxRecursion -> 0, ContourStyle -> ColorData[95, "ColorList"], BaseStyle -> Opacity[0.5], ImageSize -> Small], {df, {dline, dtri, dtet}}]
 Out= ## Mathematica

Questions? Comments? Contact a Wolfram expert »