代码之家  ›  专栏  ›  技术社区  ›  Jonas Byström

三维三角剖分算法

  •  4
  • Jonas Byström  · 技术社区  · 14 年前

    有人知道玛雅使用的三角测量算法吗?如果没有,最有可能尝试的算法是什么?我尝试了一些简单的头顶(最短/最长的结果边缘,最小角度,最小/最大面积),但他们都错了。Delaunay是最合理的算法吗?

    编辑: by the way, pseudo code on how to implement Delaunay for a 2D quad in 3D space to generate two triangles are more than welcome!

    编辑2: 不幸的是, this 不是三维空间中的答案(仅适用于二维空间)。

    4 回复  |  直到 8 年前
        1
  •  2
  •   please delete me    14 年前

    我不想再去猜测人们的意图,但是如果你只是想摆脱玛雅,你可以从一开始就提取玛雅的三角测量。 MItMeshPolygon::getTriangles .

    (The corresponding normals and vertex colours are straightforwardly accessible. UVs require a little more effort -- I don't remember the details (all my Maya code is with my ex employer) but whilst at first glance it may seem like you don't have the data, in fact it's all there, just not conveniently.)

    (另一个注意事项——如果您的艺术家足够努力,他们可以创建当 getTriangles 调用,即使它们呈现为OK并且可以使用UI进行操作。这种情况过去每隔几个月就会发生一次,所以值得记住,但可能不值得担心太多。)

    如果不想使用API或python,那么运行 polyTriangulate 在导出之前,然后 undo afterwards (to get back the original polygons) would let you examine out the triangulated mesh. (You may want or need to save the scene to a temp file, then reload it afterwards and use file to give it its old name back, if your export process does stuff that is difficult or impossible to undo.)

    This is a bit hacky, but you're guaranteed to get the exact triangulation Maya is using. Rather easier than writing your own triangulation code, and almost certainly a LOT easier than trying to work out whatever Maya does internally...

        2
  •  1
  •   Suresh    14 年前

    Jonathan Shewchuk has a very popular 2D triangulation tool called Triangle, and a 3D version should appear soon. He also has a number of papers on this topic that might be of use.

        3
  •  1
  •   andand    8 年前

    你可以试试看 Voronoi and Delaunay Techniques by Henrik Zimmer. I don't know if it's what Maya uses, but the paper describes some common techniques.

        4
  •  0
  •   Dr. belisarius    14 年前

    Here you can find an applet that demonstrates the Incremental, Gift Wrap, Divide and Conquer and QuickHull algorithms computing the Delaunay triangulation in 3D. Pointers to each algorithm are provided.