RegionHausdorffDistance[reg1,reg2]
gives the Hausdorff distance between the regions reg1 and reg2.
RegionHausdorffDistance
RegionHausdorffDistance[reg1,reg2]
gives the Hausdorff distance between the regions reg1 and reg2.
Details and Options
- RegionHausdorffDistance is also known as Hausdorff metric and Pompeiu–Hausdorff distance.
- The Hausdorff distance measures how different two regions are from each other.
- RegionHausdorffDistance is the greatest of all distances from a point in one region to the closest point in the other region.
- The distance between points p and q is taken to be Norm[p-q].
- RegionHausdorffDistance is effectively given by the maximum of MaxValue[MinValue[Norm[p-q],q∈reg2],p∈reg1] and MaxValue[MinValue[Norm[p-q],q∈reg1],p∈reg2].
- Unless the regions are closed, the Hausdorff distance may not be attained by points in the region but in the closure of the regions.
- The Hausdorff distance between two regions reg1 and reg2 is ϵ if reg1⊆RegionDilation[reg2,ϵ] and reg2⊆RegionDilation[reg1,ϵ].
Examples
open all close allBasic Examples (4)
Find the Hausdorff distance between two disks:
RegionHausdorffDistance[Disk[], Disk[{0, 0}, 3]]Graphics[{Opacity[1 / 3], Disk[], Disk[{0, 0}, 3]}, Axes -> True]Find the Hausdorff distance between the unit disk and a regular polygon:
RegionHausdorffDistance[Disk[], RegularPolygon[6]]Graphics[{Opacity[1 / 3], Disk[], RegularPolygon[6]}, Axes -> True]Plot the Hausdorff distance as the number of sides increases:
ListPlot[Table[{n, RegionHausdorffDistance[Disk[], RegularPolygon[n]]}, {n, 3, 10}], Joined -> True]Find the Hausdorff distance between two point clouds:
RegionHausdorffDistance[RandomReal[1, {1000, 2}], RandomReal[1, {1000, 2}]]Find the Hausdorff distance between a MeshRegion and its convex hull:
Subscript[ℛ, 1] = ResourceData["Stanford Bunny"];
Subscript[ℛ, 2] = ConvexHullMesh[Subscript[ℛ, 1]];RegionHausdorffDistance[Subscript[ℛ, 1], Subscript[ℛ, 2]]Graphics3D[{EdgeForm[], Opacity[0.5], Subscript[ℛ, 1], Subscript[ℛ, 2]}]Scope (9)
Special Regions (8)
RegionHausdorffDistance[Point[{{1, 1}, {1, 2}}], Point[{3, 4}]]RegionHausdorffDistance accepts coordinate lists:
RegionHausdorffDistance[{{1, 1}, {1, 2}}, {3, 4}]RegionHausdorffDistance[Line[{{0, 0}, {1, 1}}], Line[{{-1, 1}, {2, 0}}]]RegionHausdorffDistance[Line[{{0, -1, 2}, {2, -1, -3}}], Line[{{-1, 1, 3}, {2, -1, 0}}]]RegionHausdorffDistance[Polygon[{{0, 0}, {2, 1}, {1, 3}}], Polygon[{{2, 0}, {0, 3}, {-1, 1}}]]RegionHausdorffDistance[Triangle[], Rectangle[]]RegionHausdorffDistance[Simplex[{{0}, {1}}], Simplex[{{2}, {3}}]]RegionHausdorffDistance[Simplex[{{0, 0}, {2, 0}, {0, 2}}], Simplex[{{1, -1}, {1, 1}, {2, -1}}]]RegionHausdorffDistance[Simplex[{{0, 0, 0}, {2, 0, 0}, {0, 2, 0}, {0, 0, 2}}], Simplex[{{-1, 0, 1}, {2, 0, 1}, {3, 2, 0}, {2, 0, 2}}]]RegionHausdorffDistance[Rectangle[], Rectangle[{2, 1}]]RegionHausdorffDistance[Cuboid[], Cuboid[{3, 2, 1}]]RegionHausdorffDistance[Cube[], Cube[2]]RegionHausdorffDistance[Disk[], Disk[{1, 1}]]RegionHausdorffDistance[Ball[], Ball[{1, 2, 3}]]RegionHausdorffDistance[Circle[], Circle[{1, 2}]]RegionHausdorffDistance[Sphere[], Sphere[{4, 5, 6}]]RegionHausdorffDistance[Simplex[{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}], {1, 2, 3, 4}]RegionHausdorffDistance[Point[{1, 2, 3, 4, 5}], {6, 7, 8, 9, 10}]RegionHausdorffDistance[Cuboid[{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}], {11, 12, 13, 14, 15}]RegionHausdorffDistance[Ball[{1, 2, 3, 4, 5, 6, 7}, 8], {9, 10, 11, 12, 13, 14, 15}]Mesh Regions (1)
The Hausdorff distance between two 1D meshes:
ℛ = ConvexHullMesh[RandomReal[1, {10, 1}]];
𝒮 = ConvexHullMesh[RandomReal[1, {10, 1}]];RegionHausdorffDistance[ℛ, 𝒮]ℛ = ConvexHullMesh[RandomReal[1, {10, 2}]];
𝒮 = ConvexHullMesh[RandomReal[{1 / 2, 3 / 2}, {10, 2}]];Show[ℛ, HighlightMesh[𝒮, 2]]RegionHausdorffDistance[ℛ, 𝒮]ℛ = ConvexHullMesh[RandomReal[1, {20, 3}]];
𝒮 = ConvexHullMesh[RandomReal[{1 / 2, 3 / 2}, {20, 3}]];Show[ℛ, HighlightMesh[𝒮, 2]]RegionHausdorffDistance[ℛ, 𝒮]Options (2)
WorkingPrecision (2)
RegionHausdorffDistance will try to compute the distance using the same precision as its inputs:
RegionHausdorffDistance[Disk[], Point[{4, 4}]]Compute the distance using machine arithmetic:
RegionHausdorffDistance[Disk[], Point[{4, 4}], WorkingPrecision -> MachinePrecision]In some cases, the exact answer cannot be computed:
RegionHausdorffDistance[ImplicitRegion[x ^ 6 + y ^ 6 - x y <= 1, {x, y}], Point[{2, 3}]]Find the RegionHausdorffDistance using 30 digits of precision:
RegionHausdorffDistance[Disk[], Point[{4, 4}], WorkingPrecision -> 30]Applications (1)
Region Reconstruction (1)
Reconstruct a mesh from random point samples:
ℛ = ResourceData["Horse"];
𝒮 = ReconstructionMesh[RandomPoint[ℛ, 10000]];Determine the Hausdorff distance between the ground truth and reconstructed mesh:
RegionHausdorffDistance[ℛ, 𝒮]Plot how the Hausdorff distance decreases with larger sample counts:
ListPlot[Table[{n, RegionHausdorffDistance[ℛ, ReconstructionMesh[RandomPoint[ℛ, n]]]}, {n, {100, 500, 1000, 2000, 3000, 4000}}], Joined -> True]Properties & Relations (4)
The Hausdorff distance between two points is equivalent to the EuclideanDistance:
RegionHausdorffDistance[{1, 2}, {3, 4}]EuclideanDistance[{1, 2}, {3, 4}]The Hausdorff distance between two point sets is the maximum EuclideanDistance from any point to the other set:
𝒜 = {{0, 0}, {1, 2}, {4, 3}};
ℬ = {{4, 2}, {3, 0}};RegionHausdorffDistance[𝒜, ℬ] === Max[Min /@ Table[EuclideanDistance[a, b], {a, 𝒜}, {b, ℬ}]]The Hausdorff distance between a region and a single point is the furthest distance of the point to any point in the region:
RegionHausdorffDistance[Disk[], Point[{3, 5}]] === RegionFarthestDistance[Disk[], Point[{3, 5}]]RegionDistance can be used to find the nearest distance from a point to a region:
ℛ = Disk[];RegionDistance[ℛ, {3, 5}]Related Guides
History
Text
Wolfram Research (2023), RegionHausdorffDistance, Wolfram Language function, https://reference.wolfram.com/language/ref/RegionHausdorffDistance.html.
CMS
Wolfram Language. 2023. "RegionHausdorffDistance." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RegionHausdorffDistance.html.
APA
Wolfram Language. (2023). RegionHausdorffDistance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RegionHausdorffDistance.html
BibTeX
@misc{reference.wolfram_2026_regionhausdorffdistance, author="Wolfram Research", title="{RegionHausdorffDistance}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/RegionHausdorffDistance.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_regionhausdorffdistance, organization={Wolfram Research}, title={RegionHausdorffDistance}, year={2023}, url={https://reference.wolfram.com/language/ref/RegionHausdorffDistance.html}, note=[Accessed: 12-June-2026]}