aerosandbox.geometry.mesh_utilities#

Module Contents#

Functions#

stack_meshes(*meshes)

Takes in a series of tuples (points, faces) and merges them into a single tuple (points, faces). All (points,

convert_mesh_to_polydata_format(points, faces)

PyVista uses a slightly different convention for the standard (points, faces) format as described above. They

aerosandbox.geometry.mesh_utilities.stack_meshes(*meshes)[source]#

Takes in a series of tuples (points, faces) and merges them into a single tuple (points, faces). All (points, faces) tuples are meshes given in standard format.

Parameters:

*meshes (Tuple[Tuple[aerosandbox.numpy.ndarray, aerosandbox.numpy.ndarray]]) – Any number of mesh tuples in standard (points, faces) format.

Return type:

Tuple[aerosandbox.numpy.ndarray, aerosandbox.numpy.ndarray]

Returns: Points and faces of the combined mesh. Standard unstructured mesh format: A tuple of points and faces, where:

  • points is a n x 3 array of points, where n is the number of points in the mesh.

  • faces is a m x 3 array of faces if method is “tri”, or a m x 4 array of faces if method is “quad”.

    • Each row of faces is a list of indices into points, which specifies a face.

aerosandbox.geometry.mesh_utilities.convert_mesh_to_polydata_format(points, faces)[source]#

PyVista uses a slightly different convention for the standard (points, faces) format as described above. They give faces as a single 1D vector of roughly length (M*3), or (M*4) in the case of quadrilateral meshing. Basically, the mesh displayer goes down the faces array, and when it sees a number N, it interprets that as the number of vertices in the following face. Then, the next N entries are interpreted as integer references to the vertices of the face.

This has the benefit of allowing for mixed tri/quad meshes.

Parameters:
  • points (aerosandbox.numpy.ndarray) – points array of the original standard-format mesh

  • faces (aerosandbox.numpy.ndarray) – faces array of the original standard-format mesh

Returns:

(points, faces), except that faces is now in a pyvista.PolyData compatible format.

Return type:

Tuple[aerosandbox.numpy.ndarray, aerosandbox.numpy.ndarray]