您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

如何将三角形的绕组校正为3D Mesh模型的逆时针方向?

如何将三角形的绕组校正为3D Mesh模型的逆时针方向?

获取相邻信息,请假设我们有一种方法可以 在给定的边上返回三角形的邻居neighbor_on_egde( next_tria, edge )。

方法可以使用在每个 三角形中使用每个顶点的信息来实现。那是将顶点索引映射到 三角形索引列表的字典结构。通过遍历 三角形列表并为右 字典元素中的三角形的每个三角形顶点索引设置,可以轻松地创建它。

通过存储要检查方向的 三角形以及已检查哪些三角形来完成遍历。当有三角形要检查时,对其进行 检查,并添加要检查的邻居(如果未选中)。 伪代码如下所示:

to_process = set of pairs triangle and orientation edge
             initial state is one good oriented triangle with any edge on it
processed = set of processed triangles; initial empty

while to_process is not empty:
    next_tria, orientation_edge = to_process.pop()
    add next_tria in processed
    if next_tria is not opposite oriented than orientation_edge:
        change next_tria (ABC) orientation  (B<->C)
  for each edge (AB) in next_tria:
      neighbor_tria = neighbor_on_egde( next_tria, edge )
      if neighbor_tria exists and neighbor_tria not in processed:
          to_process add (neighbor_tria, edge opposite oriented (BA))
其他 2022/1/1 18:14:38 有543人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶