Subject: CGAL users discussion list
List archive
- From: Jane Tournois <>
- To:
- Subject: Re: [cgal-discuss] Finding inner vertices in mesh_optimization_lloyd_example
- Date: Thu, 28 Jan 2016 10:16:40 +0100
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
- Ironport-phdr: 9a23:2VLLfRIf0FZgph0oPNmcpTZWNBhigK39O0sv0rFitYgVKvXxwZ3uMQTl6Ol3ixeRBMOAu60C07Gd6vq9EUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35vxj7v5oseOKyxzxxODIppKZC2sqgvQssREyaBDEY0WjiXzn31TZu5NznlpL1/A1zz158O34YIxu38I46FppIZ9V77ndfE4UaBAF2ZhdHsk4dXi8xjFVwqGoHUGFX4HlwJBRAnD4ha9VZj4tm72t/F2xTKBbvHxGLs7UDDn46ZwQwLzkw8GMSQ4+SfZkJ9elqVe9TCooRE3/4nJeoeSNeE2KqHUe95cWW1cRMBWVjdpDY67aoYTFfsPNO1EqJPs4VAJqE3tVkGXGOrzx2oQ1TfN1qog3rF5HA==
Hello,
the indices that appear after each triangle and tetrahedron correspond to the domain index for each simplex :
- for a facet : the surface patch index
- for a cell : the subdomain index (and -1 outside the domain)
In a labellized image, the indices correspond to the labels available in the image.
In a gray level image, the indices are either -1 or 1 (inside/outside)
For more details, you can have a look at the mesh domain concept :
http://doc.cgal.org/latest/Mesh_3/classMeshDomain__3.html
and at the file where the output function is coded :
Mesh_3\include\CGAL\IO\File_medit.h
Best,
Jane.
--
Jane Tournois, PhD
R&D Engineer at GeometryFactory
http://www.geometryfactory.com/
Le 27/01/2016 15:27, Pierre Hallot a écrit :
Hello,
Thanks a lot for your answer, it works fine.
I have one last question, for the "liver.inr" example, if I have a look at
the out.mesh file, the last parameters for vertices (and triangles/tetrahedra) is an
integer between -1 and 3, which I think represent if they are on the boundary (2) or
inside (3) or I guess isolated for the rest.
Are those numbers accurate?
With my own .inr file (I have attached it to this message in case) they are
all at 1.
I've tried to add "c3t3.set_dimension(ch->vertex((i+3)% 4),2);" and
"c3t3.set_dimension(cit->vertex(i),3);" in the code you provided, but this seems to have no effect.
(The "c3t3.output_to_medit(medit_file);" call is made afterwards, I've check.)
I need to find which inner vertices are linked together, so simply using the
.mesh file would be great, but now that I have the inner vertices I am sure I
can find another way.
This is indeed as part of my internship and thus for my company, is this an
issue? We will comply with the GPL3 licence, if this is a licence issue.
Kind regards,
Pierre Hallot
________________________________________
From:
[]
on behalf of Andreas Fabri
[]
Sent: Wednesday, January 27, 2016 1:07 PM
To:
Subject: Re: [cgal-discuss] Finding inner vertices in
mesh_optimization_lloyd_example
Hello,
I've rewritten the program you posted and I've put it on github:
https://gist.github.com/afabri/32a7b4082208bd53b78d
I did not really try to understand your program,
so let me just make some remarks:
Note that when you have a cavity the infinite vertex is
not a vertex of a cell.
Also never create or copy a Cell, only use Cell_handle
or Cell_iterator and access data with ->
You cannot fully control the number of inner vertices,
as the mesh generator will in any case Delaunay tetrahedra.
There are less vertices if you do not set the
cell_radius_edge_ratio
Best,
Andreas
On 26/01/2016 14:36, Pierre Hallot wrote:
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
Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project
phone: +33.492.954.912 skype: andreas.fabri
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
- [cgal-discuss] Finding inner vertices in mesh_optimization_lloyd_example, Pierre Hallot, 01/26/2016
- Re: [cgal-discuss] Finding inner vertices in mesh_optimization_lloyd_example, Andreas Fabri, 01/27/2016
- RE: [cgal-discuss] Finding inner vertices in mesh_optimization_lloyd_example, Pierre Hallot, 01/27/2016
- Re: [cgal-discuss] Finding inner vertices in mesh_optimization_lloyd_example, Jane Tournois, 01/28/2016
- RE: [cgal-discuss] Finding inner vertices in mesh_optimization_lloyd_example, Pierre Hallot, 01/27/2016
- Re: [cgal-discuss] Finding inner vertices in mesh_optimization_lloyd_example, Andreas Fabri, 01/27/2016
Archive powered by MHonArc 2.6.18.