digeo.ops.trace_geodesics#

digeo.ops.trace_geodesics(mesh, starts, dirs, gradient='gfd', use_python=False, max_steps=2000, save_parallel_transport=False, save_end_direction=False, debug=False, print_warnings=True, eps=-1.0, avoid_holes=False)[source]#

Computes the straightest geodesic traces.

For a detailed description, see Straightest geodesic in the user guide.

Parameters:
  • mesh (Mesh) – The mesh to trace the geodesics

  • starts (List[MeshPoint] | MeshPointBatch) – The starting points from which the geodesics start

  • dirs (torch.Tensor) – The direction tensor (in 3d world coordinates)

  • gradient (str,) – What method to compute the gradient, can be “none”, “ep”, “abfd”, or “gfd” (default: “gfd”).

  • use_python (bool,) – If the computation should be made with python, making it easier to debug (default: False).

  • max_steps (int,) – The maximum steps for the traces (triangle hops) (default: 2000).

  • save_parallel_transport (bool,) – If the parallel transport rotation should be saved in the GeodesicInfo (default: False).

  • save_end_direction (bool,) – If the end direction should be saved in the GeodesicInfo (default: False).

  • debug (bool,) – If the returned GeodesicInfo should contain additionnal debug info (default: False).

  • print_warnings (bool,) – If warnings should be printed (default: True).

  • eps (float,) – A small epsilon value to avoid numerical issues (defaults to 10e-4 for floats and 10e-7 for doubles)

  • avoid_holes (bool,) – If the geodesic tracing should circumvent holes in the mesh (default: False) This is recommanded for meshes with small holes, but discrupts the geodesic tracing.

Returns:

The endpoints of the geodesic traces and geodesic information.

Return type:

MeshPointBatch, GeodesicInfo

Examples

>>> mesh = load_mesh_from_file(path_to_mesh, device=device)
>>> start_meshpoints = uniform_sampling(mesh, N).to(device)
>>> start_directions = torch.randn((N, 3), dtype=torch.float32).to(device)
>>> meshpoints, geodesic_info = trace_geodesics(
...     mesh, start_meshpoints, start_directions
... )