# vispy.geometry.generation module

vispy.geometry.generation.create_arrow(rows, cols, radius=0.1, length=1.0, cone_radius=None, cone_length=None)

  Create a 3D arrow using a cylinder plus cone

  Parameters:
    rows int

      Number of rows.

    cols int

      Number of columns.

    radius float

      Base cylinder radius.

    length float

      Length of the arrow.

    cone_radius float
      Radius of the cone base.

        If None, then this defaults to 2x the cylinder radius.

    cone_length float
      Length of the cone.

        If None, then this defaults to 1/3 of the arrow length.

  Returns:
    arrow MeshData

      Vertices and faces computed for a cone surface.

vispy.geometry.generation.create_box(width=1, height=1, depth=1, width_segments=1, height_segments=1, depth_segments=1, planes=None)

  Generate vertices & indices for a filled and outlined box.

  Parameters:
    width float

      Box width.

    height float

      Box height.

    depth float

      Box depth.

    width_segments int

      Box segments count along the width.

    height_segments float

      Box segments count along the height.

    depth_segments float

      Box segments count along the depth.

    planes: array_like

      Any combination of `{'-x', '+x', '-y', '+y', '-z', '+z'}` Included planes in the box construction.

  Returns:
    vertices array

      Array of vertices suitable for use as a VertexBuffer.

    faces array

      Indices to use to produce a filled box.

    outline array

      Indices to use to produce an outline of the box.

vispy.geometry.generation.create_cone(cols, radius=1.0, length=1.0)

  Create a cone

  Parameters:
    cols int

      Number of faces.

    radius float

      Base cone radius.

    length float

      Length of the cone.

  Returns:
    cone MeshData

      Vertices and faces computed for a cone surface.

vispy.geometry.generation.create_cube()

  Generate vertices & indices for a filled and outlined cube

  Returns:
    vertices array

      Array of vertices suitable for use as a VertexBuffer.

    filled array

      Indices to use to produce a filled cube.

    outline array

      Indices to use to produce an outline of the cube.

vispy.geometry.generation.create_cylinder(rows, cols, radius=[1.0, 1.0], length=1.0, offset=False)

  Create a cylinder

  Parameters:
    rows int

      Number of rows.

    cols int

      Number of columns.

    radius tuple of float

      Cylinder radii.

    length float

      Length of the cylinder.

    offset bool

      Rotate each row by half a column.

  Returns:
    cylinder MeshData

      Vertices and faces computed for a cylindrical surface.

vispy.geometry.generation.create_grid_mesh(xs, ys, zs)

  Generate vertices and indices for an implicitly connected mesh.

  The intention is that this makes it simple to generate a mesh from meshgrid data.

  Parameters:
    xs ndarray

      A 2d array of x coordinates for the vertices of the mesh. Must have the same dimensions as ys and zs.

    ys ndarray

      A 2d array of y coordinates for the vertices of the mesh. Must have the same dimensions as xs and zs.

    zs ndarray

      A 2d array of z coordinates for the vertices of the mesh. Must have the same dimensions as xs and ys.

  Returns:
    vertices ndarray

      The array of vertices in the mesh.

    indices ndarray

      The array of indices for the mesh.

vispy.geometry.generation.create_plane(width=1, height=1, width_segments=1, height_segments=1, direction='+z')

  Generate vertices & indices for a filled and outlined plane.

  Parameters:
    width float

      Plane width.

    height float

      Plane height.

    width_segments int

      Plane segments count along the width.

    height_segments float

      Plane segments count along the height.

    direction: unicode

      `{'-x', '+x', '-y', '+y', '-z', '+z'}` Direction the plane will be facing.

  Returns:
    vertices array

      Array of vertices suitable for use as a VertexBuffer.

    faces array

      Indices to use to produce a filled plane.

    outline array

      Indices to use to produce an outline of the plane.

  References

  [1]

  Cabello, R. (n.d.). PlaneBufferGeometry.js. Retrieved May 12, 2015, from http://git.io/vU1Fh

vispy.geometry.generation.create_sphere(rows=10, cols=10, depth=10, radius=1.0, offset=True, subdivisions=3, method='latitude')

  Create a sphere

  Parameters:
    rows int

      Number of rows (for method=’latitude’ and ‘cube’).

    cols int

      Number of columns (for method=’latitude’ and ‘cube’).

    depth int

      Number of depth segments (for method=’cube’).

    radius float

      Sphere radius.

    offset bool

      Rotate each row by half a column (for method=’latitude’).

    subdivisions int

      Number of subdivisions to perform (for method=’ico’)

    method str

      Method for generating sphere. Accepts ‘latitude’ for latitude- longitude, ‘ico’ for icosahedron, and ‘cube’ for cube based tessellation.

  Returns:
    sphere MeshData

      Vertices and faces computed for a spherical surface.

previous

vispy.geometry.curves module

next

vispy.geometry.isocurve module