Skip to main content
`Ctrl`+`K`

# vispy.geometry.triangulation module

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

  Bases: `object`

  Constrained delaunay triangulation

  Implementation based on [1].

  Parameters:
    pts array

      Nx2 array of points.

    edges array

      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:
    vertices array-like

      The vertices.

  Returns:
    vertices array-like

      The vertices.

    triangles array-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

  [3]

  https://rufat.be/triangle/

  [4]

  vispy/vispy