vispy.geometry.polygon module#

class vispy.geometry.polygon.PolygonData(vertices=None, edges=None, faces=None)#

Bases: object

Polygon class for data handling

Parameters:
vertices(Nv, 3) array

Vertex coordinates. If faces is not specified, then this will instead be interpreted as (Nf, 3, 3) array of coordinates.

edges(Nv, 2) array

Constraining edges specified by vertex indices.

faces(Nf, 3) array

Indexes into the vertex array.

Notes

All arguments are optional.

add_vertex(vertex)#

Adds given vertex and retriangulates to generate new faces.

Parameters:
vertexarray-like

The vertex to add.

property convex_hull#

Return an array of vertex indexes representing the convex hull.

If faces have not been computed for this mesh, the function computes them. If no vertices or faces are specified, the function returns None.

property edges#

Return an array (Nv, 2) of vertex indices.

If no vertices or faces are specified, the function returns None.

property faces#

Return an array (Nf, 3) of vertex indexes, three per triangular face in the mesh.

If faces have not been computed for this mesh, the function computes them. If no vertices or faces are specified, the function returns None.

triangulate()#

Triangulates the set of vertices and stores the triangles in faces and the convex hull in convex_hull.

property vertices#

Return an array (Nf, 3) of vertices.

If only faces exist, the function computes the vertices and returns them. If no vertices or faces are specified, the function returns None.