triangle_uvs
是一个numpy数组,用于存储三角形网格的每个三角形的UV坐标。UV坐标用于将2D纹理映射到3D网格表面上,其定义范围为 [0, 1]
。
该属性仅对具有纹理贴图的三角形网格有用。
import open3d as o3d
import numpy as np
# 创建三角形网格,并随机生成triangle_uvs
vertices = np.asarray([
[0, 0, 0],
[1, 0, 0],
[1, 1, 0],
[0, 1, 0]
])
triangles = np.asarray([
[0, 1, 2],
[2, 3, 0]
])
triangle_uvs = np.random.rand(triangles.shape[0], 3, 2) # 随机生成UV坐标
mesh = o3d.geometry.TriangleMesh()
mesh.vertices = o3d.utility.Vector3dVector(vertices)
mesh.triangles = o3d.utility.Vector3iVector(triangles)
mesh.triangle_uvs = o3d.utility.Vector2dVector(triangle_uvs)
# 访问triangle_uvs
print(mesh.triangle_uvs)