Edge search algorithm using vertices (2D and 3D) in the grid

I have a grid with certain types of elements (e.g. triangular, tetra). For each element, I know all its vertices, i.e. A triangular two-dimensional element will have 3 vertices v1, v2 and v3, whose x, y, z-coordinates are known.

Question 1

I am looking for an algorithm that will return all edges ... in this case:

edge (v1, v2), edge (v1, v3), edge (v2, v3). Based on how many vertices each element has, the algorithm must efficiently determine edges.

Question 2

I use C ++, so what would be the most efficient way to store information about the edges returned by the above algorithm? For example, all that interests me is the tuple (v1, v2), which I want to use for some calculations, and then forget about it.

thank

+5
source share
3 answers

You can use a half edge data structure.

article_halfedge.png
, . , A B, , A- > B B- > A. 3 , , , . , . . ( ). , . , . Btw, , , .

+7

, :

  • ?
  • ?
  • ?

, .

?

?

( ) ( node node , ), node , . , , , , , . . [] [2] , , .

, , 2D. 3D , , . , , , .

, . -. , . , .

?

? , ? ? ?

, . , , , , "" , , .

?

, ?

, . node . , , (6 node) - . , , . node, node , , .

, , . . node , - 6 .

mesh , node . , . , .

+5

, , .

" " - , .

Here are some open source libraries that will do this for you (grok code for algorithms):

+1
source

All Articles