Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

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


Chronological Thread 
  • From: Pierre Hallot <>
  • To: "" <>
  • Subject: RE: [cgal-discuss] Finding inner vertices in mesh_optimization_lloyd_example
  • Date: Wed, 27 Jan 2016 14:27:13 +0000
  • Accept-language: en-US, fr-FR
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:gGUgvx+kL7nPxP9uRHKM819IXTAuvvDOBiVQ1KB80ewcTK2v8tzYMVDF4r011RmSDdqds6gP1bCempujcFJDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXsq3G/pQQfBg/4fVIsYL+lRciK1Y/pjaibwN76XUZhvHKFe7R8LRG7/036l/I9ps9cEJs30QbDuXBSeu5blitCLFOXmAvgtI/rpMYwu3cYhvQ66sQVUbnmZ79qCvtDHTE+OiY04tfqvF/NV0yU934EWyIXlBRPRAPK5RW/UpbquTbhrblB33zQNsL/SfU4WC+p8rxwYB7ukiYOcTAjuimDgcN5iOdXoQmqugdk64/SeoCccvRkKPDzZ9QfEFJAU9xLWmRhC4e4aJdHW/IAMPxCos/9rl8KqgeWHgSqH+7hzi4OjXjzi/5pm989GB3LiVRzV+kFt27Z+Y34

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


Attachment: test.inr
Description: test.inr




Archive powered by MHonArc 2.6.18.

Top of Page