Rakshika,

There is one big issue left to make your mesh healing algorithm generally
applicable: The right orientation of the edges. Currently you test if the
normal of a triangle points towards the origin or away from it. This can
work for convex shapes but fails e.g. for a torus.

I want to outline an alternative approach here. Its details have to be
determined step-by-step.

First we see that your algorithm requires that every triangle has the same
orientation but it is not important if this is "clockwise" or
"counterclockwise". (Moreover, what's inside and outside depends on our
view on the space. It hasn't to be Euclidean.)

Therefore let's start with the first triangle from the bag, define this as
right oriented, and add its edges to the double connected edge list. Then
look for another triangle in the bag which shares with the first one an
edge and add it such that the common edge points to the other direction. Go
on with adding triangles until the bag is empty.

What kind of problems could arise here? There are at least 2:
- More than 2 triangles could have an edge in common (this is a nice
example of it:
https://upload.wikimedia.org/wikipedia/commons/b/b8/Modell_der_Weierstra%C3%9Fschen_p-Funktion_-Schilling._XIV._7ab._8_-_313._314-.jpg
).
- There are two or more not by an edge connected parts of the mesh.

We have to see how to deal with these issues best. For the start: If an
edge is used by more than two triangles don't use it for searching
connected faces; and, is it important that two unconnected parts of the
mesh have the same orientation? Would it be feasible to flip the
orientation of a mesh part at the moment we need it?

Some thoughts regarding the implementation: I would recommend to implement
two functions in MeshConversion: AddTriangleToCache() and ProcessCache()
(the names can differ, the "Cache" (in fact a bag of triangles) could be an
own class as well). AddTriangleToCache() takes three points and adds them
to a bag of triangles, maybe with some preprocessing as identifying nearby
points. ProcessCache() performs the above described algorithm. It uses the
bag of triangles, a list of currently unmatched edges, and maybe a list of
more than two times used edges to do this.

I hope I could make the basic idea clear. Details have to be determined in
further discussions.

Regards,
Daniel
------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to