# stitch a patch on a triangle mesh

This topic is 4552 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I'm doing hole filling on a mesh of triangle. So for a particular hole : 1) i compute an implicit equation that will more or less fit the hole, 2) i use marching cubes to have a triangle patch out of the equation, 3) And then we have to stitch the patch to the hole and remove the non necessary triangles. (1) and (2) are done, even if marching cubes are very slow but i have problems with (3). example of mesh very simple (used for test) (a square of 8*8 with a hole in the middle) : http://s2.photobucket.com/albums/y36/ioda100/?action=view¤t=carre8_trou_simple.jpg&refPage=&imgAnch=imgAnch2 here is the result after step 1 and 2 : http://s2.photobucket.com/albums/y36/ioda100/?action=view¤t=carre_et_patch.jpg&refPage=&imgAnch=imgAnch1 ps : mesh are more like this normallly : http://s2.photobucket.com/albums/y36/ioda100/?action=view¤t=area_5pts.jpg&refPage=&imgAnch=imgAnch7 My idea was : 1) i have a list of the points along the hole of the mesh (in the order) 2) for all the points from the mesh and from the patch, i have a structure that can give me for any particular point all its neightbors (and the triangle(s) sharing this edge). 3) i need to find on the patch, a path corresponding to the hole : for each point of the mesh hole, i need to find the nearest point corresponding on the patch and connect them. 4) when 1 2 3 are doe i think i have the way to merge them. So the PROBLEM is the point (3). First i found a good way to do it but it only works in 2D or in only a few case in 3D... : 1) I take a point arbitrary on the patch (P) 2) i take the first point of the hole (R) 3) i look at the neighbors of P and take the nearest to R and take its neighbors... until none of its neighbors are nearest to R. So i have the point corresponding to R on the patch. 4) Then i take the second point of the hole and i start from the point found in (3)... -> i have my path on the patch but it won't work in 3D... So how to find the path on the patch? I can for each point of the hole compare to all the points of the patch and take the nearest, but it could be long and i'll still have the problem to connect them together (needed for merging hole path and patch path). So Any idea to find the path on the patch or to do the stitching of the patch in an other way? Thx in advance

##### Share on other sites
No one has a little idea of how to perform that?

##### Share on other sites
If nobody has a better idea, i think i will do like this :

1) For each point of the border of the hole, i will test all the point of the patch and keep the closest.
-> i will have for each point of the hole, the corresponding point on the patch

2) I need to connect all the corresponding point on the patch together in the same order than the points of the hole.
-> the problem is to know all the points which form the path between 2 corresponding points on the patch.

As said before, i have a structure that can tell all the neighbors of each point.

Has somebody an idea to connect these points in a way not too slow?

##### Share on other sites
Find the corresponding point on the patch for each point of the hole and use Dijkstra to connect adjacent points?

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 15
• 14
• 46
• ### Forum Statistics

• Total Topics
634060
• Total Posts
3015300
×