RSVP for your your local TensorFlow Everywhere event today!

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" ( 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" ( ICML 2019.
  2. "Mesh R-CNN" ( ICCV 2019.

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


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.