colour.volume.mesh Module

Mesh Volume Computations Helpers

Defines helpers objects related to volume computations.

colour.volume.mesh.is_within_mesh_volume(points, mesh, tolerance=None)[source]

Returns if given points are within given mesh volume using Delaunay triangulation.

Parameters:
  • points (array_like) – Points to check if they are within mesh volume.
  • mesh (array_like) – Points of the volume used to generate the Delaunay triangulation.
  • tolerance (numeric, optional) – Tolerance allowed in the inside-triangle check.
Returns:

Is within mesh volume.

Return type:

bool

Notes

  • This definition requires scipy to be installed.

Examples

>>> mesh = np.array([[-1.0, -1.0, 1.0],
...                  [1.0, -1.0, 1.0],
...                  [1.0, -1.0, -1.0],
...                  [-1.0, -1.0, -1.0],
...                  [0.0, 1.0, 0.0]])
>>> is_within_mesh_volume(np.array([0.0005, 0.0031, 0.0010]), mesh)
array(True, dtype=bool)
>>> a = np.array([[0.0005, 0.0031, 0.0010],
...               [0.3205, 0.4131, 0.5100]])
>>> is_within_mesh_volume(a, mesh)
array([ True, False], dtype=bool)