简体   繁体   中英

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. The hard part is that it need to be done in O(nt) or O(ntlog2(nt)) for all the triangle in my mesh. 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).

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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