waxmorph.data.sample_mesh_pair

waxmorph.data.sample_mesh_pair#

waxmorph.data.sample_mesh_pair(source_path, target_path, n_points=2000, target_extent=10.0, *, source_extent=None, max_particles=None, seed=0)[source]#

Sample independent, equal-count source and target clouds.

Each repaired mesh is normalized and starts from its own volume-derived radius:

\[r = \left(\frac{3V}{4\pi N}\right)^{1/3}, \qquad d_{\min} = 1.2\,r,\]

Exact-count sampling may lower r and d_min together; returned radius fields hold the effective values. Source and target use seed and seed+1. Their rows contain reproducible independent samples. target_extent=None means 10; source_extent defaults to the target extent. Recorded max_particles is never below n_points.

Returns:

  • "source_pos" – source agent centers, float32, shape [N, 3].

  • "target_pos": target agent centers, float32, shape [N, 3].

  • "radius": effective source radius (alias of "source_radius").

  • "R_init": initial uniform radius for the rollout (equals the source radius).

  • "n_points": requested count N.

  • "n_source": number of source points (equals N).

  • "n_target": number of target points (equals N).

  • "max_particles": recorded capacity, max(max_particles, n_points).

  • "source_extent": source normalization extent (float).

  • "target_extent": target normalization extent (float).

  • "source_radius": effective source particle radius (float).

  • "target_radius": effective target particle radius (float).

  • "target_radii": alias of "target_radius" for sequence-API symmetry (float).

  • "target_mesh": the normalized target trimesh.Trimesh.

Parameters:
Return type:

dict

Exact-count failure raises RuntimeError; invalid counts, extents, or volume raise ValueError.