vispy.geometry.triangulation module#

class vispy.geometry.triangulation.Triangulation(pts, edges)#

Bases: object

Constrained delaunay triangulation

Implementation based on [1].

Parameters:
ptsarray

Nx2 array of points.

edgesarray

Nx2 array of edges (dtype=int).

Notes

  • Delaunay legalization is not yet implemented. This produces a proper triangulation, but adding legalisation would produce fewer thin triangles.

  • The pts and edges arrays may be modified.

References

[1]

Domiter, V. and Žalik, B. Sweep‐line algorithm for constrained Delaunay triangulation

triangulate()#

Do the triangulation.

vispy.geometry.triangulation.triangulate(vertices)#

Triangulate a set of vertices.

This uses a pure Python implementation based on [1].

If Triangle by Jonathan R. Shewchuk [2] and the Python bindings triangle [3] are installed, this will be used instead. Users need to acknowledge and adhere to the licensing terms of these packages.

In the VisPy PolygonCollection Example [4] a speedup of 97% using Triangle/triangle can be achieved compared to the pure Python implementation.

Parameters:
verticesarray-like

The vertices.

Returns:
verticesarray-like

The vertices.

trianglesarray-like

The triangles.

References

[1]

Domiter, V. and Žalik, B. Sweep‐line algorithm for constrained Delaunay triangulation

[2]

Shewchuk J.R. (1996) Triangle: Engineering a 2D quality mesh generator and Delaunay triangulator. In: Lin M.C., Manocha D. (eds) Applied Computational Geometry Towards Geometric Engineering. WACG 1996. Lecture Notes in Computer Science, vol 1148. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0014497