Tuesday 20 July 2021

Representation of a triangulation by different data structures

import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import Delaunay

points = np.array([[0.2, 0], [0.1, 1.1], [0.6, 0.1], [1, 0.5], [0.6,0.9], [0.4,0.4]])
tri = Delaunay(points)

#plot
plt.triplot(points[:,0], points[:,1], tri.simplices)
plt.plot(points[:,0], points[:,1], 'o')
plt.show()

print(tri.points)
"""
[[0.2 0. ]
[0.  1.1]
[0.6 0. ]
[1.  1. ]
[0.2 0.8]
[0.4 0.4]]
"""
print(tri.simplices)
"""
[[0 5 1]
[5 4 1]
[4 5 3]
[5 2 3]
[2 5 0]]
"""

Delaunay

This is a delaunay triangulation of points array. I have points (tri.points) and triangles (tri.simplices) arrays as outputs. I need to convert these into half-edge data structure, winged-edge data structure, corner table data structure and quad edge data structures for different representations and choose which one stores less space. Are there any libraries for these conversions in Python or should I code it all by myself?



from Representation of a triangulation by different data structures

No comments:

Post a Comment