colour.geometry.primitive_vertices_grid_mpl

colour.geometry.primitive_vertices_grid_mpl(width=1, height=1, depth=0, width_segments=1, height_segments=1, origin=array([0, 0]), axis='+z')[source]

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

Parameters
  • width (numeric, optional) – Grid width.

  • height (numeric, optional) – Grid height.

  • depth (numeric, optional) – Grid depth.

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

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

  • origin (array_like, optional) – Grid origin on the construction plane.

  • axis (array_like, optional) – {‘+z’, ‘+x’, ‘+y’, ‘yz’, ‘xz’, ‘xy’}, Axis the grid will be normal to, or plane the grid will be co-planar with.

Returns

Grid primitive vertices.

Return type

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