22from compas_cgal ._cgal import triangulations
33
44
5- def constrained_delaunay_triangulation (boundary , holes = None , curves = None , maxlength = None ):
6- """Construct a constrained Delaunay triangulation.
5+ def delaunay_triangulation (vertices ):
6+ """Construct a Delaunay triangulation.
7+
8+ Parameters
9+ ----------
10+ vertices : list of :class:`compas.geometry.Point`
11+ Vertices of the triangulation.
12+
13+ Returns
14+ -------
15+ list
16+ The faces of the triangulation.
17+
18+ Notes
19+ -----
20+ ...
21+
22+ """
23+ vertices = np .asarray (vertices , dtype = np .float64 )
24+ return triangulations .delaunay_triangulation (vertices )
25+
26+
27+ def constrained_delaunay_triangulation (boundary , points = None , holes = None , curves = None ):
28+ """Construct a Constrained Delaunay triangulation.
29+
30+ Parameters
31+ ----------
32+ boundary : :class:`compas.geometry.Polygon`
33+ The boundary of the triangulation.
34+ points : list of :class:`compas.geometry.Point`, optional
35+ Additional internal points.
36+ holes : list of :class:`compas.geometry.Polygon`, optional
37+ Internal boundary polygons.
38+ curves : list of :class:`compas.geometry.Polyline`, optional
39+ Internal constraint curves.
40+
41+ Returns
42+ -------
43+ list
44+ The vertices and faces of the triangulation.
45+
46+ Notes
47+ -----
48+ ...
49+
50+ """
51+ boundary = np .asarray (boundary , dtype = np .float64 )
52+
53+ points = points or []
54+ points = np .asarray (points , dtype = np .float64 )
55+
56+ if holes :
57+ holes = [np .asarray (hole , dtype = np .float64 ) for hole in holes ]
58+ else :
59+ holes = []
60+
61+ if curves :
62+ curves = [np .asarray (curve , dtype = np .float64 ) for curve in curves ]
63+ else :
64+ curves = []
65+
66+ return triangulations .constrained_delaunay_triangulation (boundary , points , holes , curves , is_conforming = False )
67+
68+
69+ def conforming_delaunay_triangulation (boundary , points = None , holes = None , curves = None ):
70+ """Construct a Conforming Delaunay triangulation.
71+
72+ Parameters
73+ ----------
74+ boundary : :class:`compas.geometry.Polygon`
75+ The boundary of the triangulation.
76+ points : list of :class:`compas.geometry.Point`, optional
77+ Additional internal points.
78+ holes : list of :class:`compas.geometry.Polygon`, optional
79+ Internal boundary polygons.
80+ curves : list of :class:`compas.geometry.Polyline`, optional
81+ Internal constraint curves.
82+
83+ Returns
84+ -------
85+ list
86+ The vertices and faces of the triangulation.
87+
88+ Notes
89+ -----
90+ ...
91+
92+ """
93+ boundary = np .asarray (boundary , dtype = np .float64 )
94+
95+ points = points or []
96+ points = np .asarray (points , dtype = np .float64 )
97+
98+ if holes :
99+ holes = [np .asarray (hole , dtype = np .float64 ) for hole in holes ]
100+ else :
101+ holes = []
102+
103+ if curves :
104+ curves = [np .asarray (curve , dtype = np .float64 ) for curve in curves ]
105+ else :
106+ curves = []
107+
108+ return triangulations .constrained_delaunay_triangulation (boundary , points , holes , curves , is_conforming = True )
109+
110+
111+ def refined_delaunay_mesh (boundary , points = None , holes = None , curves = None , maxlength = None , is_optimized = False ):
112+ """Construct a refined Delaunay mesh.
7113
8114 Parameters
9115 ----------
10116 boundary : :class:`compas.geometry.Polygon`
11117 The boundary of the triangulation.
118+ points : list of :class:`compas.geometry.Point`, optional
119+ Additional internal points.
12120 holes : list of :class:`compas.geometry.Polygon`, optional
13121 Internal boundary polygons.
14122 curves : list of :class:`compas.geometry.Polyline`, optional
15123 Internal constraint curves.
16124 maxlength : float, optional
17125 The maximum length of the triangle edges.
126+ is_optimized : bool, optional
127+ Apply LLoyd's optimisation.
18128
19129 Returns
20130 -------
@@ -26,18 +136,21 @@ def constrained_delaunay_triangulation(boundary, holes=None, curves=None, maxlen
26136 ...
27137
28138 """
29- boundary = np .array (boundary , dtype = np .float64 )
139+ boundary = np .asarray (boundary , dtype = np .float64 )
140+
141+ points = points or []
142+ points = np .asarray (points , dtype = np .float64 )
30143
31144 if holes :
32- holes = [np .array (hole , dtype = np .float64 ) for hole in holes ]
145+ holes = [np .asarray (hole , dtype = np .float64 ) for hole in holes ]
33146 else :
34147 holes = []
35148
36149 if curves :
37- curves = [np .array (curve , dtype = np .float64 ) for curve in curves ]
150+ curves = [np .asarray (curve , dtype = np .float64 ) for curve in curves ]
38151 else :
39152 curves = []
40153
41154 maxlength = maxlength or 0.0
42155
43- return triangulations .constrained_delaunay_triangulation (boundary , holes , curves , maxlength = maxlength )
156+ return triangulations .refined_delaunay_mesh (boundary , points , holes , curves , maxlength = maxlength , is_optimized = is_optimized )
0 commit comments