Skip to main content

Multi-stat Hausdorff distance for 3D mesh surfaces (min, max, mean, percentile)

Project description

hausdorff-stats

Multi-stat bidirectional Hausdorff distance for 3D mesh surfaces.

Returns min, max, mean, and 95th-percentile distances in both directions — not just the single worst-case number.

Installation

pip install hausdorff-stats

For point-to-cell distance (projects onto triangle surfaces via VTK):

pip install hausdorff-stats[vtk]

Quick start

Point-to-point (numpy arrays)

import numpy as np
from hausdorff_stats import hausdorff_metrics

# Two point clouds of shape (N, 3)
a = np.random.rand(500, 3)
b = np.random.rand(600, 3) + 0.1

result = hausdorff_metrics(a, b)

result.hausdorff      # bidirectional Hausdorff distance
result.mean_a_to_b    # mean distance from A to B
result.p95_b_to_a     # 95th percentile from B to A
result.summary()      # dict of all stats (handy for pandas / JSON)

Point-to-cell (VTP mesh files)

from hausdorff_stats import hausdorff_metrics

result = hausdorff_metrics(
    "surface_a.vtp",
    "surface_b.vtp",
    method="point_to_cell",
)

This projects each point onto the nearest triangle cell on the opposite surface, giving more accurate distances for tessellated geometry.

Available statistics

hausdorff_metrics returns a HausdorffResult with:

Property Description
hausdorff Bidirectional Hausdorff distance (max of both directed maxima)
min_a_to_b / min_b_to_a Minimum directed distance
max_a_to_b / max_b_to_a Maximum directed distance
mean_a_to_b / mean_b_to_a Mean directed distance
p95_a_to_b / p95_b_to_a 95th percentile directed distance
percentile(q) Arbitrary percentile for both directions
summary() Flat dict of all stats

Raw per-point distance arrays are also accessible as distances_a_to_b and distances_b_to_a.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hausdorff_stats-0.1.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hausdorff_stats-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file hausdorff_stats-0.1.0.tar.gz.

File metadata

  • Download URL: hausdorff_stats-0.1.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hausdorff_stats-0.1.0.tar.gz
Algorithm Hash digest
SHA256 61b7bbfc0fbb4291d7386c02474bc31ca00d8ac6efb6240ff71d9f4ff0b1dad8
MD5 ae123a128573c090f3471c2ce7769af1
BLAKE2b-256 03901d4bb1396675f4174d90d4e5d493625c10347c690f0fc17ebd00deb56266

See more details on using hashes here.

Provenance

The following attestation bundles were made for hausdorff_stats-0.1.0.tar.gz:

Publisher: publish.yml on rolandshc/hausdorff-stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hausdorff_stats-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hausdorff_stats-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e7133caaf927aa0bcc38c94b3b0871e82e60712821e4a38e5e67d85859c9a01
MD5 e2eb3ceb24e5902973224d516144d58d
BLAKE2b-256 9ee8e329f20d1aaad4c693d14a199d80ef42a5ab0ae172d4cfbba9747488bf6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for hausdorff_stats-0.1.0-py3-none-any.whl:

Publisher: publish.yml on rolandshc/hausdorff-stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page