magrittetorch.tools.mesher

Contains a few functions to remesh points clouds

magrittetorch.tools.mesher.point_cloud_add_spherical_outer_boundary(remeshed_positions, nb_boundary, radius, healpy_order=10, origin=array([0., 0., 0.]))

Function for specifying a spherical outer boundary in a remeshed point cloud. First clears the region outside the sphere and then constructs a spherical boundary using healpy.

Parameters:
  • remeshed_positions (numpy array of float) – Positions of the points in the point cloud. Assumes the boundary points to lie in front.

  • nb_boundary (unsigned int) – The number of boundary points in the point cloud.

  • radius (positive float) – Radius of the spherical outer boundary

  • healpy_order (unsigned int) – The number of points on the outer boundary is defined as: 12*(healpy_order**2), as the healpy discretization of the sphere is used.

  • origin (1 by 3 numpy vector of float) – Contains x,y,z coordinates of center point of the sphere (by default [0.0,0.0,0.0]^T)

Returns:

  • remeshed_positions (numpy array of float) – The positions of the points in the remeshed point cloud. The boundary points lie in front.

  • number of boundary points (unsigned int) – The number of boundary points in the remeshed point cloud.

magrittetorch.tools.mesher.remesh_point_cloud(positions, data, max_depth=9, threshold=0.05, hullorder=3)

Remeshing method by comparing the maximal variation of the data against the threshold. Uses a recursive method with maximal depth max_depth. The hullorder specifies the density of the generated uniform boundary.

Parameters:
  • positions (numpy array of float OR Quantity) – 3D positions of the points (dimension of array N by 3)

  • data (numpy array of float OR Quantity) – Corresponding data for the points, in order to determine the variation. Must be non-zero

  • max_depth (int) – Maximal recursion depth. Determines the miminal scale in the remeshed point cloud. Must be positive

  • threshold (float) – The threshold to use when deciding the variation to be small enough in order to approximate a region with a single point. Must be positive

  • hullorder (int) – Determines the amount of boundary points generated in the hull around the remeshed point cloud. Increasing this by 1 results in a 4 times increase in number of boundary points. Must be positive

Returns:

  • remeshed_positions (numpy array of float) – The positions of the points in the remeshed point cloud. The boundary points lie in front.

  • number of boundary points (unsigned int) – The number of boundary points in the remeshed point cloud.