API Reference

age3d.calculate_bounds_height(mesh)

Returns the minimum z-coordinate of the vertices at the boundary of the given mesh.

Parameters:

mesh (open3d.geometry.TriangleMesh) – A triangle mesh object.

Returns:

The minimum z-coordinate of the vertices at the boundary of the given mesh.

Return type:

float

age3d.clean_mesh(mesh)

Merge the close vertices of a mesh to remove noise.

Parameters:

mesh – The mesh to be cleaned.

Returns:

None

age3d.erode(mesh: TriangleMesh, iterations: int = 2, erosion_lifetime: int = 10, direction=None, verbose=[])

Erodes the mesh using the particle deposition and erosion method.

Parameters:
  • mesh (open3d.geometry.TriangleMesh) – The mesh to be eroded.

  • iterations (int, optional) – The number of iterations for the erosion process. Defaults to 2.

  • erosion_lifetime (int, optional) – The maximum number of times a vertex can be eroded. Defaults to 10.

  • direction (numpy.ndarray, optional) – The direction of the rain as a numpy array of shape (3,). If not provided, the vertex mask is calculated from the mesh’s bounding box. Defaults to None.

  • verbose (list[str], optional) – A list of strings containing information to be printed. Possible strings include ‘all’, ‘vertex_progression’, ‘vector_direction’, ‘vector_angle’, ‘ray’, ‘ray_scene’, ‘mesh’, and ‘collision’. Defaults to an empty list.

Returns:

A tuple containing the updated vertex indices and the eroded mesh.

Return type:

Tuple[np.ndarray, open3d.geometry.TriangleMesh]

The verbose argument takes a list of strings that specify what information should be printed.
  • ‘all’: Prints all below.

  • ‘vertex_progression’: Prints information about vertex triples.

  • ‘vector_direction’: Prints information about vector directions.

  • ‘vector_angle’: Prints information about vector angles.

  • ‘ray’: Prints information about the ray being casted.

  • ‘ray_scene’: Prints information about the raycasting scene.

  • ‘mesh’: Prints information about the mesh.

  • ‘collision’: Prints information about the collision detection.

age3d.export_mesh(file_path: str, mesh)

Export a mesh to a given file path using the open3d library.

Parameters:
  • file_path (str) – The file path where the mesh will be saved.

  • mesh – The mesh to be exported.

Returns:

None

age3d.find_accessible(mesh, rain_direction)

Returns the indices and coordinates of the vertices accessible by a given angle of particles’ direction.

Parameters:
  • mesh (open3d.geometry.TriangleMesh) – The mesh to check.

  • rain_direction (numpy.ndarray) – The direction angle of the rain as a numpy array of shape (3,). If direction is [0,0,0], every vertex is chosen.

Returns:

A tuple of two NumPy arrays representing the neighboring vertex indices and coordinates.

Return type:

Tuple[np.ndarray, np.ndarray]

age3d.find_all_above(mesh, value: float, inclusive=False)

Finds all the vertices above the given value in the z-coordinate.

Parameters:
  • mesh (open3d.geometry.TriangleMesh) – The input mesh.

  • value (float) – The value above which to find vertices.

  • inclusive (bool, optional) – Whether to include vertices with value equal to the given value. Defaults to False.

Returns:

Two numpy arrays, one containing the indices and the other containing the vertices that are above the given value in the z-coordinate.

Return type:

tuple

age3d.find_all_below(mesh, value: float, inclusive=False)

Finds all the vertices below the given value in the z-coordinate.

Parameters:
  • mesh (open3d.geometry.TriangleMesh) – The input mesh.

  • value (float) – The value below which to find vertices.

  • inclusive (bool, optional) – Whether to include vertices with value equal to the given value. Defaults to False.

Returns:

Two numpy arrays, one containing the indices and the other containing the vertices that are below the given value in the z-coordinate.

Return type:

tuple

age3d.find_all_between(mesh, lower_value: float, higher_value: float) ndarray

Returns a NumPy array of vertices whose z-coordinate is between the given lower and higher values.

Parameters:
  • mesh (open3d.geometry.TriangleMesh) – A triangle mesh object.

  • lower_value (float) – The lower bound of the z-coordinate.

  • higher_value (float) – The higher bound of the z-coordinate.

Returns:

A NumPy array of vertices whose z-coordinate is between the given lower and higher values.

Return type:

np.ndarray

age3d.find_maximum(mesh, k: int = 1, idx_mask=[])

Finds the maximum value(s) and corresponding index(s) in the z-coordinate of the mesh’s vertices.

Parameters:
  • mesh (open3d.geometry.TriangleMesh) – The input mesh.

  • k (int, optional) – The number of maximum values to return. Defaults to 1.

  • idx_mask (list, optional) – List of vertex indices to consider for the maximum search. Defaults to empty list.

Returns:

Two numpy arrays, one containing the index(s) of the maximum value(s) and the other containing the maximum value(s) in the z-coordinate of the mesh’s vertices.

Return type:

tuple

age3d.find_minimum(mesh, k: int = 1, idx_mask=[])

Find the k number of vertices having minimum z-coordinate of a mesh.

Parameters:
  • mesh (open3d.geometry.TriangleMesh) – The input mesh.

  • k (int, optional) –

  • idx_mask (list, optional) – A list of indices of vertices to be considered for finding minimum vertices.

Returns:

A tuple of two numpy arrays. The first array contains the indices of the minimum

vertices and the second array contains the coordinates of the minimum vertices.

Return type:

tuple

age3d.find_neighbors(mesh, index: int)

Returns the indices and coordinates of the neighboring vertices of the given vertex index.

Parameters:
  • mesh (open3d.geometry.TriangleMesh) – A triangle mesh object.

  • index (int) – The index of the vertex.

Returns:

A tuple of two NumPy arrays representing the neighboring vertex indices and coordinates.

Return type:

Tuple[np.ndarray, np.ndarray]

age3d.get_mask(mesh, idx)

Create a mask array for a specific vertex of the mesh.

Parameters:
  • mesh – The mesh for which the mask is to be created.

  • idx – The index of the vertex for which the mask is to be created.

Returns:

A boolean mask array with True value for the given index and False for all

other vertices of the mesh.

Return type:

np.ndarray

age3d.import_mesh(file_path: str)

Imports stl file as Mesh

Parameters:

file_path (str) – file path of stl file

Returns:

Mesh to be processed.

Return type:

mesh (open3d.geometry.TriangleMesh)

age3d.make_point_cloud(vertices, color)

Creates a point cloud object with the given vertices and color.

Parameters:
  • vertices (np.ndarray) – A NumPy array of vertices.

  • color (tuple) – A tuple of RGB values (0-255).

Returns:

A point cloud object.

Return type:

open3d.geometry.PointCloud

age3d.mesh_details(mesh) tuple

Retrieve details of a mesh in the form of numpy arrays for vertices and triangles.

Parameters:

mesh – The mesh for which the details are to be extracted.

Returns:

A tuple of two numpy arrays. The first array contains the vertices of the mesh and the second array contains the triangles of the mesh.

Return type:

tuple

age3d.mesh_subdivision(mesh, iterations=1)

Returns a new triangle mesh object obtained by subdividing the given mesh.

Parameters:
  • mesh (open3d.geometry.TriangleMesh) – A triangle mesh object.

  • iterations (int) – The number of times to subdivide the mesh.

Returns:

A new triangle mesh object obtained by subdividing the given mesh.

Return type:

open3d.geometry.TriangleMesh

age3d.visualize(entries, show_wireframe=False) None

Visualize a single mesh or a list of meshes using the open3d library.

Parameters:
  • entries – The mesh/meshes to be visualized. It can be a single mesh or a list of meshes.

  • show_wireframe (bool) – A flag to show/hide the wireframe of the mesh/meshes.

Returns:

None