简体   繁体   English

网格2D三角剖分

[英]Mesh 2D triangulation

I am trying to make a program that for a point in space find the triangle in the mesh containing it. 我正在尝试制作一个程序,用于在空间中的点上找到包含三角形的网格中的三角形。 I have some intermediary step. 我有一些中间步骤。 But i am trying to find another way to do it because it's not efficient. 但是我正在尝试找到另一种方法,因为它效率不高。

First: 第一:

For K a triangle and ia vertex of this triangle to be able to find the adjacent triangle and opposite to this vertex. 对于K,一个三角形和该三角形的一个顶点可以找到与该顶点相反的相邻三角形。 The hard part is that it need to be done in O(nt) or O(ntlog2(nt)) for all the triangle in my mesh. 困难的部分是,对于网格中的所有三角形,都需要使用O(nt)或O(ntlog2(nt))来完成。 I wanted to use unordened map in order to store all the side of each triangle that way I could find the triangle I am looking for in O(1) each so for all the mesh in O(nt). 我想使用无序贴图来存储每个三角形的所有边,这样我可以在O(1)中找到要查找的三角形,因此可以在O(nt)中找到所有网格。

But I don't know how to code my unordened map in order to have the 2 vertex's values in the first colone and the triangle's number in the second and third column. 但是我不知道如何编码我的无序映射,以便在第一个冒号中具有2个顶点的值,在第二和第三列中具有三角形的数。

My mesh attribut are: 我的网格属性是:

 public:
  //attribut
  std::vector<Sommet> m_Sommet; // Sommet's array
  std::vector<Triangle> m_Triangle; //Triangle's array

If you have any help, it would be really nice. 如果您有任何帮助,那将是非常好的。

You should use a partitioning structure associated to your mesh, a bounding volume hierarchy is pretty simple to compute, lightweight and efficient (you may look at this page for various sorting algorithms). 您应该使用与网格关联的分区结构,边界体积层次结构的计算非常简单,轻巧且高效(您可以在此页面上找到各种排序算法)。 If your mesh is static, a kd-tree should be faster, but also more complex to build. 如果您的网格物体是静态的,那么kd-tree应该会更快,但构建起来也会更复杂。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM