fixmesh package

fixmesh.cut

fixmesh.cut.cut_repair(mesh)[source]

Removes intersecting faces and fills open boundary holes. Keeps only the number of major components that existed before cutting.

Parameters:

mesh (pymesh.Mesh) – Input mesh, possibly with self-intersections.

Returns:

Repaired, non-intersecting, watertight mesh.

Return type:

trimesh.Trimesh

fixmesh.detach

fixmesh.detach.detach_repair(input, contact_threshold=0.06, max_iters=10, num_sample_points=50000)[source]

Fix self-intersections by detaching mesh.

Parameters:
  • input (PyMesh) – The input mesh.

  • contact_thresold (float, optional) – The separation distance between meshes. Defaults to 0.06.

  • max_iters (int, optional) – The number of iterations to repair. Defaults to 10.

  • num_sample_points (int, optional) – The number of sampling points of the “reference” mesh.

Returns:

A new mesh with no self-intersections.

Return type:

trimesh.Mesh

  1. Load a mesh and split into submeshes.

  2. Identify smallest-volume piece as ‘inner’, largest-volume piece as ‘outer’.

  3. Convert each to Open3D.

  4. Iteratively shrink the inner mesh so it stays inside the outer.

Adjust the values of max_iters and num_sample_points based on your input mesh.

Increasing contact_threshold increases robustness.

fixmesh.detach.detach_repair_raw_2(input, contact_threshold=0.06, max_iters=10, num_sample_points=50000)[source]

Fix self-intersections by detaching mesh.

Parameters:
  • input (mesh) – The input mesh.

  • contact_threshold (float, optional) – The separation distance between meshes. Defaults to 0.06.

  • max_iters (int, optional) – The number of iterations to repair. Defaults to 10.

  • num_sample_points (int, optional) – The number of sampling points of the “reference” mesh.

Returns:

A new mesh with no self-intersections.

Return type:

o3d.geometry.TriangleMesh