vispy.geometry.generation module

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

Create a 3D arrow using a cylinder plus cone

Parameters
rowsint

Number of rows.

colsint

Number of columns.

radiusfloat

Base cylinder radius.

lengthfloat

Length of the arrow.

cone_radiusfloat
Radius of the cone base.

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

cone_lengthfloat
Length of the cone.

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

Returns
arrowMeshData

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)[source]

Generate vertices & indices for a filled and outlined box.

Parameters
widthfloat

Box width.

heightfloat

Box height.

depthfloat

Box depth.

width_segmentsint

Box segments count along the width.

height_segmentsfloat

Box segments count along the height.

depth_segmentsfloat

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
verticesarray

Array of vertices suitable for use as a VertexBuffer.

facesarray

Indices to use to produce a filled box.

outlinearray

Indices to use to produce an outline of the box.

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

Create a cone

Parameters
colsint

Number of faces.

radiusfloat

Base cone radius.

lengthfloat

Length of the cone.

Returns
coneMeshData

Vertices and faces computed for a cone surface.

vispy.geometry.generation.create_cube()[source]

Generate vertices & indices for a filled and outlined cube

Returns
verticesarray

Array of vertices suitable for use as a VertexBuffer.

filledarray

Indices to use to produce a filled cube.

outlinearray

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)[source]

Create a cylinder

Parameters
rowsint

Number of rows.

colsint

Number of columns.

radiustuple of float

Cylinder radii.

lengthfloat

Length of the cylinder.

offsetbool

Rotate each row by half a column.

Returns
cylinderMeshData

Vertices and faces computed for a cylindrical surface.

vispy.geometry.generation.create_grid_mesh(xs, ys, zs)[source]

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
xsndarray

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

ysndarray

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

zsndarray

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

Returns
verticesndarray

The array of vertices in the mesh.

indicesndarray

The array of indices for the mesh.

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

Generate vertices & indices for a filled and outlined plane.

Parameters
widthfloat

Plane width.

heightfloat

Plane height.

width_segmentsint

Plane segments count along the width.

height_segmentsfloat

Plane segments count along the height.

direction: unicode

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

Returns
verticesarray

Array of vertices suitable for use as a VertexBuffer.

facesarray

Indices to use to produce a filled plane.

outlinearray

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')[source]

Create a sphere

Parameters
rowsint

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

colsint

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

depthint

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

radiusfloat

Sphere radius.

offsetbool

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

subdivisionsint

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

methodstr

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

Returns
sphereMeshData

Vertices and faces computed for a spherical surface.