1 rri_metrics.point_mesh

rri_metrics.point_mesh

Low-level squared point–mesh distance primitives for oracle RRI.

This module wraps PyTorch3D geometric distance implementations so downstream code can compute accuracy, completeness, and bidirectional distances in a uniform, torch-first manner. Device support follows the installed PyTorch3D backend; this module does not implement a separate fallback. Callers supply pre-sampled point clouds and one shared mesh. Directional components are returned separately to expose the accuracy/completeness split.

For a point set \(P\) and mesh triangles \(F\), accuracy averages the squared distance from each point to its closest triangle, while completeness averages the squared distance from each triangle to its closest point. The scalar error is their sum. The local distance follows the installed PyTorch3D kernel: triangles with area strictly below 0.005 square metres (50 square centimetres) are treated as their three boundary segments, not their filled interiors. Numerically degenerate normals also take this boundary branch. Both directional kernels receive the same unchanged default threshold. Subdividing an unchanged surface into sufficiently small faces can therefore change accuracy, separately from completeness’s equal-face weighting. Exact clipping and retriangulation can expose this dependence; its effect on campaign rankings is not established. Metric-frame coordinates therefore yield square-metre values; :class:aria_nbv.oracle.PreparedRriScorer normalizes their difference into dimensionless RRI.

1.1 Classes

Name Description
DistanceBreakdown Directional point-mesh distances produced by the Chamfer primitive.

1.1.1 DistanceBreakdown

rri_metrics.point_mesh.DistanceBreakdown(accuracy, completeness, bidirectional)

Directional point-mesh distances produced by the Chamfer primitive.

1.1.1.1 Attributes

Name Description
accuracy Point-to-mesh distances from the reconstruction to ground truth.
completeness Mesh-to-point distances from ground truth to the reconstruction.
bidirectional Sum of accuracy and completeness.

1.2 Functions

Name Description
chamfer_point_mesh Compute directional mean-squared distances for one point cloud and mesh.
chamfer_point_mesh_batched Compute candidate-batched squared point–mesh distances.
chamfer_prepared_point_mesh Compute one point-cloud distance using one authoritative prepared mesh.
chamfer_prepared_point_mesh_batched Compute candidate-batched distances against one prepared mesh authority.

1.2.1 chamfer_point_mesh

rri_metrics.point_mesh.chamfer_point_mesh(points, gt_verts, gt_faces)

Compute directional mean-squared distances for one point cloud and mesh.

1.2.1.1 Parameters

Name Type Description Default
points Tensor["P 3", float32] Point cloud in the same metric coordinate frame as gt_verts, conventionally world frame metres. required
gt_verts Tensor["V 3", float32] Ground-truth mesh vertices in the common frame, metres. required
gt_faces Tensor["F 3", int64] Triangle vertex indices into gt_verts. required

1.2.1.2 Returns

Name Type Description
DistanceBreakdown class:DistanceBreakdown of scalar Tensor["", float32] accuracy,
DistanceBreakdown completeness, and bidirectional errors in square metres.

1.2.1.3 Theory

With \(d^2(p,f)\) denoting squared point-to-triangle distance,

\[ D(P,M)=\frac{1}{|P|}\sum_{p\in P}\min_{f\in F}d^2(p,f) +\frac{1}{|F|}\sum_{f\in F}\min_{p\in P}d^2(p,f). \]

Here \(d\) is the operational local distance. At areas at least 0.005 square metres and with a nondegenerate backend normal, it uses the filled triangle; below that strict area threshold or with a numerically degenerate normal, it uses its boundary segments. For a right triangle with 2 cm legs, the interior point (5 mm, 5 mm, 0) therefore has distance 5 mm rather than the ideal surface distance zero.

The second term weights mesh triangles equally; it is not an area-weighted surface integral. Accuracy additionally depends on which faces cross the small-triangle threshold after tessellation. Historical labels keep this protocol; this wrapper does not select a new threshold.

1.2.2 chamfer_point_mesh_batched

rri_metrics.point_mesh.chamfer_point_mesh_batched(
    points,
    lengths,
    gt_verts,
    gt_faces,
)

Compute candidate-batched squared point–mesh distances.

1.2.2.1 Parameters

Name Type Description Default
points Tensor["C P_max 3", float32] Padded candidate point clouds in a common metric frame, conventionally world frame metres. required
lengths Tensor["C", int64] Valid point count for each candidate; padded rows beyond each count are ignored. required
gt_verts Tensor["V 3", float32] Shared ground-truth mesh vertices in the same frame, metres. required
gt_faces Tensor["F 3", int64] Shared triangle indices into gt_verts. required

1.2.2.2 Returns

Name Type Description
DistanceBreakdown class:DistanceBreakdown whose fields are
DistanceBreakdown Tensor["C", float32] mean-squared errors in square metres. The
DistanceBreakdown candidate axis and input order are preserved.

1.2.2.3 Notes

This primitive applies no candidate-validity mask. Callers must remove or mask invalid actions rather than interpreting their numeric distance as low utility.

1.2.3 chamfer_prepared_point_mesh

rri_metrics.point_mesh.chamfer_prepared_point_mesh(points, mesh)

Compute one point-cloud distance using one authoritative prepared mesh.

1.2.4 chamfer_prepared_point_mesh_batched

rri_metrics.point_mesh.chamfer_prepared_point_mesh_batched(
    points,
    lengths,
    mesh,
    *,
    candidate_chunk_size=None,
)

Compute candidate-batched distances against one prepared mesh authority.

Back to top