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 = (0, 0), axis: Literal['+z', '+x', '+y', 'yz', 'xz', 'xy'] | str = '+z') NDArrayFloat[source]#

Generate vertices for a grid primitive composed of quadrilateral primitives for use with Matplotlib mpl_toolkits.mplot3d.art3d.Poly3DCollection class.

Parameters:
  • width (float) – Width of the primitive.

  • height (float) – Height of the primitive.

  • depth (float) – Depth of the primitive.

  • width_segments (int) – Number of width segments defining quad primitive counts along the width axis.

  • height_segments (int) – Number of height segments defining quad primitive counts along the height axis.

  • origin (ArrayLike) – Origin of the primitive on the construction plane.

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

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. ]]])