Mesh#

class vivid3d.Mesh#

Bases: vivid3d._core.BaseMesh

Triangular Mesh class that holds polygonal surfaces.

label#

Optional name of the object, not required to be unique.

Type

str

n_polygons#

# of vertices

Type

number

n_vertices#

# of vertices

Type

number

material#

The material instance used by 3D renderers

Type

vivid3d.Material

colormap#

The Colormap instance used to map scalar data to colors. See https://matplotlib.org/stable/gallery/color/colormap_reference for list of all supported colormaps.

Type

matplotlib.colors.ColorMap, default: “plasma”

opacity#

Float in the range of 0.0 - 1.0 indicating how transparent the material is. A value of 0.0 indicates fully transparent, 1.0 is fully opaque.

Type

number

export(self: vivid3d._core.BaseMesh, output_file: str = 'Vivid3dModel', file_type: str = 'glb') None#

Exports Mesh to output_file with given file_type format. For full list of supported file formats, see: https://vivid.readthedocs.io/en/latest/userguide/basics.html#supported-file-types

Parameters
  • output_file (str, default: "Vivid3dModel") – File Directory to export to

  • file_type (str, default: 'glb') – File format to export to

export_to_blob(self: vivid3d._core.BaseMesh, file_type: str = 'glb') vivid3d._core.BlobData#

Exports Mesh to Blob with given file_type format. For full list of supported file formats, see: https://vivid.readthedocs.io/en/latest/userguide/basics.html#supported-file-types

Parameters

file_type (str, default: 'glb') – File format to export to

Returns

blob (vivid3d.BlobData) – Object containing exported model file blobs

move(self: vivid3d._core.BaseMesh, direction: Point3D) None#

Moves Mesh in X,Y,Z by direction(X,Y,Z)

Parameters

direction (Point3D) – The vector to move by

reduce(self: vivid3d._core.Mesh, decimation_percent: float = 0.5, max_error: float = 0.5) None#

Reduces Poly-Count of smoothed meshes.

Reduces file size while trying to maintain the the shape as much as possible. It’s recommended to not over do it.

Parameters
  • decimation_percent ((0.0-1.0), default: 0.5) – Reduce the model polygon count to this percent.

  • max_error ((0.0-1.0), default = 0.5) – Maximum error in reduction. Recommended to not touch.

Notes

Prefer to create smaller models as it tends to have a cleaner result. See __example__ for down-sampling datasets.

rotate(self: vivid3d._core.BaseMesh, norm_vec: Point3D, radians_angle: float) None#

Rotate the Mesh points around a normal vector by an angle in radians

Parameters
  • norm_vec (Point3D (normalized)) – Unit vector from (0,0,0) of the BaseMesh

  • radians_angle (float) – The angle to rotate in radians

scale(self: vivid3d._core.BaseMesh, scale: Point3D) None#

Scales Mesh in X,Y,Z by scale(X,Y,Z)

Parameters

scale (Point3D) – The vector to scale by

set_color(self: vivid3d._core.BaseMesh, color: str) None#

Set the mesh texture to a single color.

Parameters

color (str) – See https://htmlcolorcodes.com/color-names/ for list of all available colors.

show(self: vivid3d._core.BaseMesh, height: int = 600) object#

Render and view the mesh in a viewer window.

Parameters

height (int, default: 600) – height in pixels to open the viewer

Returns

html (str or IPython.display.HTML) – The html with embedded model.

smooth(self: vivid3d._core.Mesh, n_iterations: int = 5, alpha_weight: float = 0.7, beta_weight: float = 0.0) None#

Smooths the surface by HC Laplacian Algorithm. Recommended to use default values.

See http://informatikbuero.com/downloads/Improved_Laplacian_Smoothing_of_Noisy_Surface_Meshes.pdf for reference.

Parameters
  • n_iterations (number, default: 5) – Number of iterations to smooth by

  • alpha_weight ((0.0-1.0), default: 0.7) – Percent to move the point by each iteration

  • beta_weight ((0.0-1.0), default: 0.0) – Percent to hold the point pack to original position. Used for high iteration smoothing, to retain total volume. If n_iterations > 20, recommended beta_weight = 0.5

transform(self: vivid3d._core.BaseMesh, matrix: List[Point3D[3]]) None#

Transform Mesh by transformation matrix

User Guide#