vcg.face.FFAdj类提供了一个面的表面拓扑结构。它存储了面的邻接面、边和顶点的信息。
获取当前面索引。
def getFace(self) -> int:
"""
获取面的索引。
:return: 面的索引。
"""
pass
获取与当前面共享边id的面索引。
def getAdjFace(self, id: int) -> int:
"""
返回与当前面共享边id的邻接面索引。
:param id: 需要查询的边的索引。
:return: 邻接面索引。
"""
pass
获取与当前面共享顶点id和id+1的边的索引。
def getAdjEdge(self, id: int) -> int:
"""
返回与当前面共享顶点id和id+1的邻接边索引。
:param id: 需要查询的左侧顶点的索引。
:return: 邻接边索引。
"""
pass
获取与当前面共享边id和id+1的顶点的索引。
def getAdjVert(self, id: int) -> int:
"""
返回与当前面共享边id和id+1的邻接顶点索引。
:param id: 需要查询的左侧顶点的索引。
:return: 邻接顶点索引。
"""
pass
获取当前面上与顶点id相邻、逆时针方向的顶点的索引。
def getPrevVertex(self, id: int) -> int:
"""
返回当前面上与顶点id相邻、逆时针方向的顶点索引。
:param id: 需要查询的顶点索引。
:return: 相邻的顶点索引。
"""
pass
获取当前面上与顶点id相邻、顺时针方向的顶点的索引。
def getNextVertex(self, id: int) -> int:
"""
返回当前面上与顶点id相邻、顺时针方向的顶点索引。
:param id: 需要查询的顶点索引。
:return: 相邻的顶点索引。
"""
pass
面的索引。
面上边的数量。
存储面上每个顶点的索引。
import vcg
mesh = vcg.Mesh()
# 添加一个立方体
file = vcg.create_cube(mesh, 2.0)
# 获取第一个面的邻接顶点
face = mesh.faceBegin()
for i in range(face.nEdge):
adj_vert = face.getAdjVert(i)
print(adj_vert)
输出:
1
0
3