Skip to content

Commit 7c311d1

Browse files
committed
update examples
1 parent b2fc58c commit 7c311d1

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

examples/delaunay3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from compas.datastructures import Mesh
22
from compas.utilities import geometric_key
33
from compas_plotters import Plotter
4-
from compas.geometry import conforming_delaunay_triangulation
4+
from compas_triangle.delaunay import conforming_delaunay_triangulation
55

66
points = [
77
[2.994817685045075, 10.855606612493078, 0.0],
@@ -16,7 +16,7 @@
1616
[5.2909301507195865, 6.342692886748852, 0.0]
1717
]
1818

19-
vertices, faces = conforming_delaunay_triangulation(points, angle=30, area=0.02)
19+
vertices, faces = conforming_delaunay_triangulation(points, angle=30, area=0.5)
2020

2121
mesh = Mesh.from_vertices_and_faces(vertices, faces)
2222

examples/delaunay5.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from compas_plotters import Plotter
2+
from compas.geometry import Polygon, Translation
3+
from compas.datastructures import Mesh
4+
from compas_triangle.delaunay import conforming_delaunay_triangulation
5+
6+
# ==============================================================================
7+
# Constraints
8+
# ==============================================================================
9+
10+
boundary = Polygon.from_sides_and_radius_xy(4, 10)
11+
boundary = list(boundary)
12+
13+
hole = Polygon.from_sides_and_radius_xy(8, 2)
14+
15+
hole1 = hole.transformed(Translation.from_vector([4, 0, 0]))
16+
hole2 = hole.transformed(Translation.from_vector([-4, 0, 0]))
17+
hole3 = hole.transformed(Translation.from_vector([0, 4, 0]))
18+
hole4 = hole.transformed(Translation.from_vector([0, -4, 0]))
19+
20+
holes = [list(hole1), list(hole2), list(hole3), list(hole4)]
21+
22+
# ==============================================================================
23+
# Triangulation
24+
# ==============================================================================
25+
26+
V, F = conforming_delaunay_triangulation(boundary, polygons=holes, area=0.3)
27+
28+
mesh = Mesh.from_vertices_and_faces(V, F)
29+
30+
# ==============================================================================
31+
# Viz
32+
# ==============================================================================
33+
34+
plotter = Plotter(figsize=(8, 8))
35+
plotter.add(mesh, sizepolicy='absolute', vertexsize=5)
36+
plotter.zoom_extents()
37+
plotter.show()

0 commit comments

Comments
 (0)