Skip to content

Commit 22fb279

Browse files
committed
examples
1 parent 584e1c6 commit 22fb279

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

QuickHull/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,27 @@ def quick_hull(points, ccw=True):
6666
(2, 0, 3),
6767
(0, 1, 3),
6868
]
69+
70+
Merging output::
71+
72+
points = [
73+
(0.0, 0.0, 0.0), # A
74+
(0.0, 0.0, 1.0), # B
75+
(0.0, 1.0, 0.0), # C
76+
(1.0, 0.0, 0.0), # D
77+
]
78+
79+
vertices, triangles = QuickHull.quick_hull(points)
80+
triangle_vertices = [(vertices[a], vertices[b], vertices[c]) for a, b, c in triangles]
81+
82+
# The output will be:
83+
84+
triangle_vertices = [
85+
( (0.0, 1.0, 0.0), (1.0, 0.0, 0.0), (0.0, 0.0, 1.0) ), # C, D, B
86+
( (0.0, 0.0, 1.0), (1.0, 0.0, 0.0), (0.0, 0.0, 0.0) ), # B, D, A
87+
( (1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 0.0) ), # D, C, A
88+
( (0.0, 1.0, 0.0), (0.0, 0.0, 1.0), (0.0, 0.0, 0.0) ), # C, B, A
89+
]
6990
'''
7091

7192
return hull.quick_hull(tuple(points), ccw)

0 commit comments

Comments
 (0)