Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Finding inner vertices in mesh_optimization_lloyd_example

Subject: CGAL users discussion list

List archive

[cgal-discuss] Finding inner vertices in mesh_optimization_lloyd_example


Chronological Thread 
  • From: Pierre Hallot <>
  • To: "" <>
  • Subject: [cgal-discuss] Finding inner vertices in mesh_optimization_lloyd_example
  • Date: Tue, 26 Jan 2016 13:36:36 +0000
  • Accept-language: en-US, fr-FR
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:7Ek87By1L2MitvHXCy+O+j09IxM/srCxBDY+r6Qd0e0VIJqq85mqBkHD//Il1AaPBtWEraocwLGO+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuStGU15z8jLj60qaQSjsLrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGwD884mooRLXqz+Oqg5VrdFFy8OMmYv5cStuwOJBV+E6XIYF2kXiRFVGBPt7RfgX563vDGs5cRn3yzPBcz7V6o5ERSr66NsVFe8kCYKLSQ0tmHejsh3kIpArRS6qhJ70sjfZ4TDZ6k2Rb/UYd5PHTkJZc1WTSEUWo4=

Hello,

I have a few questions on the mesh_optimization_lloyd_example that can be found in cgal/Mesh_3/examples/Mesh_3/mesh_optimization_lloyd_example.
I am currently using the provided example (liver.inr.gz) and just trying to interact with the results.

First, I am trying to find the points that are inside the created mesh, and to differentiate them from those that are on the boundary.
From what I've read, I can find them based on the fact that a vertex on the boundary will have one adjacent vertex which is infinite.
I thus made the following code that I added at the end of the file without modifying anything else:

Tr t = c3t3.triangulation();

// sets so that the same points are not added twice
std::set<C3t3::Vertex_handle> innerVertices;
std::set<C3t3::Vertex_handle> outerVertices;

for (C3t3::Cells_in_complex_iterator cell = c3t3.cells_in_complex_begin(), end = c3t3.cells_in_complex_end(); cell != end; ++cell)
{
    const Tr::Cell c(*cell);

    // each tetrahedra has 4 vertices
    for (int i = 0; i < 4; ++i)
    {
         // the vertices connected to the one we are checking
         std::vector<C3t3::Vertex_handle> adjacent_vertices;
         t.adjacent_vertices(c.vertex(i), std::back_inserter(adjacent_vertices));
         bool _onBoundary_ = false;
         int counter = 0;
         for (std::vector<C3t3::Vertex_handle>::iterator it = adjacent_vertices.begin(); it != adjacent_vertices.end(); ++it)
         {
             if (t.is_infinite(adjacent_vertices.at(counter)))
            {
                 _onBoundary_ = true;
                 break;
            }
             ++counter;
         }

         if (!onBoundary)
         {
             innerVertices.insert(c.vertex(i));
         }
         else
         {
            outerVertices.insert(c.vertex(i));
         }
    }
}

std::cout << "CountInner: " << innerVertices.size() << std::endl;
std::cout << "CountOuter: " << outerVertices.size() << std::endl;

However, no vertex seems to be infinite and thus every point is considered as inside the complex. How is it possible?


Related to this, the File_medit.h outputs a dimension in the .mesh file (the fourth parameter).
I think I read somewhere that 3 means it is inside the complex while 2 is on the boundary.
That's exactly what I need, however for the liver, there are about 2000 vertices (out of a total of 3361) with dimension 3 and less than a thousand with dimension 2, the rest has a dimension of 1, 0 or -1.
I would have expected to have much more vertices on the boundary than inside the complex however, is what I am saying correct?
Moreover, if I replace the liver.inr.gz file by my own .inr file, everything has a dimension of 1, which makes this method useless.


Lastly, is it possible to fix the number of vertices inside the complex that will be created during the make_mesh_3 call? For instance, I would like to have only 256 vertices inside. (I don't care about the number on the boundary.)

Kind regards,
Pierre Hallot



Archive powered by MHonArc 2.6.18.

Top of Page