Skip to contents

Compares already aligned surfaces using closest points on triangles, not nearest vertices. No registration, rescaling, or triangulation is performed.

Usage

score.surface(
  coords,
  triangles,
  reference_coords,
  reference_triangles,
  sample_size = 5000L,
  seed = 1L
)

Arguments

coords, reference_coords

Numeric three-column vertex matrices.

triangles, reference_triangles

Three-column matrices of one-based triangle indices into the corresponding vertex matrix. Open surfaces and different triangulations are supported. Duplicate faces are rejected.

sample_size

Number of independent area-uniform samples per surface, at least two. Increase this to assess Monte Carlo convergence.

seed

Nonnegative integer seed, at most 2147483646. Separate fixed streams are used for the two directions; the caller's RNG state is restored.

Value

A list with rms, forward_rms, reverse_rms, forward_mean, reverse_mean, rms_mc_se, surface areas, zero-area face counts, sample_size, and seed. Forward means coords to reference.

Details

For surfaces A and B, squared symmetric RMS is one half of the sum of the area-normalized integrals of squared closest-point distance in the two directions. Each direction has equal weight regardless of total area. The returned score has coordinate-distance units. The Monte Carlo standard error uses a delta-method approximation; it does not quantify mesh discretization error, alignment uncertainty, or between-cloud variability. Zero observed error gives a standard error of zero, not a proof of identity. Samples are uniform over triangle area, so overlapping faces count with multiplicity. Self-intersections are not repaired or detected. Zero-area faces have no sampling mass but remain distance targets. A surface with no positive-area faces is rejected. No Hausdorff maximum is estimated.

Examples

x <- rbind(c(0, 0, 0), c(1, 0, 0), c(0, 1, 0))
f <- matrix(1:3, nrow = 1)
score.surface(x, f, x, f, sample_size = 100)$rms
#> [1] 0