Skip to content

Commit cd13c81

Browse files
committed
make triangulation available as plugin
1 parent b5fa5ff commit cd13c81

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/compas_cgal/triangulation.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import numpy as np
2+
from compas.plugins import plugin
23
from compas_cgal._cgal import triangulations
34

45

5-
def delaunay_triangulation(vertices):
6-
"""Construct a Delaunay triangulation.
6+
@plugin(category="traingulation", requires=['compas_cgal'])
7+
def delaunay_triangulation(points):
8+
"""Construct a Delaunay triangulation from a set of points.
79
810
Parameters
911
----------
10-
vertices : list of :class:`compas.geometry.Point`
11-
Vertices of the triangulation.
12+
points : list of :class:`compas.geometry.Point`
13+
Points of the triangulation.
1214
1315
Returns
1416
-------
@@ -20,10 +22,11 @@ def delaunay_triangulation(vertices):
2022
...
2123
2224
"""
23-
vertices = np.asarray(vertices, dtype=np.float64)
25+
vertices = np.asarray(points, dtype=np.float64)
2426
return triangulations.delaunay_triangulation(vertices)
2527

2628

29+
@plugin(category='triangulation', requires=['compas_cgal'])
2730
def constrained_delaunay_triangulation(boundary, points=None, holes=None, curves=None):
2831
"""Construct a Constrained Delaunay triangulation.
2932
@@ -66,6 +69,7 @@ def constrained_delaunay_triangulation(boundary, points=None, holes=None, curves
6669
return triangulations.constrained_delaunay_triangulation(boundary, points, holes, curves, is_conforming=False)
6770

6871

72+
@plugin(category='triangulation', requires=['compas_cgal'])
6973
def conforming_delaunay_triangulation(boundary, points=None, holes=None, curves=None):
7074
"""Construct a Conforming Delaunay triangulation.
7175
@@ -109,7 +113,7 @@ def conforming_delaunay_triangulation(boundary, points=None, holes=None, curves=
109113

110114

111115
def refined_delaunay_mesh(boundary, points=None, holes=None, curves=None, maxlength=None, is_optimized=False):
112-
"""Construct a refined Delaunay mesh.
116+
"""Construct a refined Delaunay mesh [1]_.
113117
114118
Parameters
115119
----------
@@ -131,9 +135,9 @@ def refined_delaunay_mesh(boundary, points=None, holes=None, curves=None, maxlen
131135
list
132136
The vertices and faces of the triangulation.
133137
134-
Notes
135-
-----
136-
...
138+
References
139+
----------
140+
.. [1] https://doc.cgal.org/latest/Mesh_2/index.html#secMesh_2_meshes
137141
138142
"""
139143
boundary = np.asarray(boundary, dtype=np.float64)

0 commit comments

Comments
 (0)