colour.geometry.primitive_vertices_grid_mpl#

colour.geometry.primitive_vertices_grid_mpl(width: float = 1, height: float = 1, depth: float = 0, width_segments: int = 1, height_segments: int = 1, origin: ArrayLike = np.array([0, 0]), axis: Literal['+z', '+x', '+y', 'yz', 'xz', 'xy'] | str = '+z') NDArrayFloat[source]#

Return the vertices of a grid primitive made of quad primitives for use with Matplotlib mpl_toolkits.mplot3d.art3d.Poly3DCollection class.

Parameters:
  • width (float) – Grid width.

  • height (float) – Grid height.

  • depth (float) – Grid depth.

  • width_segments (int) – Grid width segments, quad primitive counts along the width.

  • height_segments (int) – Grid height segments, quad primitive counts along the height.

  • origin (ArrayLike) – Grid origin on the construction plane.

  • axis (Literal['+z', '+x', '+y', 'yz', 'xz', 'xy'] | str) – Axis the grid will be normal to, or plane the grid will be co-planar with.

Returns:

Grid primitive vertices.

Return type:

numpy.ndarray

Examples

>>> primitive_vertices_grid_mpl(width_segments=2, height_segments=2)
array([[[ 0. ,  0. ,  0. ],
        [ 0.5,  0. ,  0. ],
        [ 0.5,  0.5,  0. ],
        [ 0. ,  0.5,  0. ]],

       [[ 0. ,  0.5,  0. ],
        [ 0.5,  0.5,  0. ],
        [ 0.5,  1. ,  0. ],
        [ 0. ,  1. ,  0. ]],

       [[ 0.5,  0. ,  0. ],
        [ 1. ,  0. ,  0. ],
        [ 1. ,  0.5,  0. ],
        [ 0.5,  0.5,  0. ]],

       [[ 0.5,  0.5,  0. ],
        [ 1. ,  0.5,  0. ],
        [ 1. ,  1. ,  0. ],
        [ 0.5,  1. ,  0. ]]])