我在 Python 中使用 CGAL,我希望能够在三角测量中将数据添加到面部句柄。似乎 Python 允许我存储这些信息,但它不会持续存在,例如:
from CGAL.CGAL_Kernel import Point_2
from CGAL.CGAL_Triangulation_2 import Delaunay_triangulation_2
#triangulate a square
points = [Point_2(0,0), Point_2(0,1), Point_2(1,0), Point_2(1,1)]
D = Delaunay_triangulation_2()
D.insert(points)
#attempt to store information in face handle
for f in D.finite_faces():
f.data = 'my data'
#this information does not persist
for f in D.finite_faces():
print(f.data)
运行上述结果
AttributeError: 'Delaunay_triangulation_2_Face_handle' object has no attribute 'data'
是否可以在三角测量中存储信息,如果可以,如何存储?