Module: tfg.geometry.representation.mesh.sampler

Computes a weighted point sampling of a triangular mesh.

This op computes a uniform sampling of points on the surface of the mesh. Points are sampled from the surface of each triangle using a uniform distribution, proportional to a specified face density (e.g. face area).

Uses the approach mentioned in the TOG 2002 paper "Shape distributions" (https://dl.acm.org/citation.cfm?id=571648) to generate random barycentric coordinates.

This op can be used for several tasks, including better mesh reconstruction. For example, see these recent papers demonstrating reconstruction losses using this op:

  1. "GEOMetrics: Exploiting Geometric Structure for Graph-Encoded Objects" (https://arxiv.org/abs/1901.11461) ICML 2019.
  2. "Mesh R-CNN" (https://arxiv.org/abs/1906.02739) ICCV 2019.

Op is differentiable w.r.t mesh vertex positions.

Functions

area_weighted_random_sample_triangle_mesh(...): Performs a face area weighted random sampling of a tri mesh.

generate_random_barycentric_coordinates(...): Generate uniformly sampled random barycentric coordinates.

generate_random_face_indices(...): Generate a sample of face ids given per face probability.

triangle_area(...): Computes triangle areas.

weighted_random_sample_triangle_mesh(...): Performs a face probability weighted random sampling of a tri mesh.