Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Moving points in Mesh3

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Moving points in Mesh3


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Moving points in Mesh3
  • Date: Wed, 05 Jan 2011 16:42:24 +0100

Rasmus Bach Nielsen wrote:
Hi Sebastien,

Thanks for the quick reply.

I use a wrapper-class Mesh which contains the following function:

void Mesh::move_vertex(C3t3::Vertex_handle v, Vector u)
{
Point_3 location(v->point().x() + u[0], v->point().y() + u[1],
v->point().z() + u[2]);
c3t3.triangulation().move(v, location);
}


this is called from main using:

for (C3t3::Facet_iterator iter = m.facets_begin();iter !=
m.facets_end(); ++iter)
{
C3t3::Cell_handle c1 = iter->first;
for(int i = 0; i < 4; i++)
{
C3t3::Vertex_handle v = c1->vertex(i);
if(!m.is_infinite(v) && (v->in_dimension() == 2))
{
Vector_3 current_pos = v->point() -
Point_3(CGAL::ORIGIN);
Vector u(3);
u[0] = current_pos.x();
u[1] = current_pos.y();
u[2] = current_pos.z();
cout << "Vertex dimension: " << v->in_dimension() << endl;
cout << "Vertex position: " << v->point().x() << ", " <<
v->point().y() << ", " << v->point().z() << endl;
cout << "Displacement vector: " << u[0] << ", " << u[1] <<
", " << u[2] << endl;
m.move_vertex(v, u);
moved_vertex = true;
cout << "Vertex position after move: " << v->point() << endl;
break;
}
}
if(moved_vertex)
break;
}

Moving a point will invalidate several facets and cells. So your for(int) loop may not be doing what you expect as c1 may not be who
you think it is.


Why are you not simply iterating over vertices of the triangulation to make your move operations?

Note that the move function exits but is not documented for Regular_triangulation_3 (the triangulation type of C3t3), and thus it may disappear. The precondition to use this function is that no vertices get hidden at any time, meaning in particular no two points must become
identical.

S.


The expected result is that 1 vertex on the surface of the mesh has its distance to CGAL::ORIGIN doubled The actual result seems to be a hole in the mesh. My suspicion is that I am somehow turning some tetrahedron inside out or something of the sort. The breaks are there because the Facet_iterator is invalidated by the move (or rather: I get an exception indicating something of that sort).

Regards
Rasmus

On 05-01-2011 16:02, Sebastien Loriot (GeometryFactory) wrote:
Rasmus Bach Nielsen wrote:
Hi,

I am trying to use a Mesh_complex_3_in_triangulation_3 as the discretization for an elastic solver. My problem right now is that when I move points in the underlying triangulation, the only visual result I have been able to produce when outputting the mesh after moving a point, is a hole in the mesh. My question now is: Am I right in thinking that I should be able to see changes in the underlying triangulation reflected in the geometry of the Mesh, or is this just me misunderstanding the relationship between the triangulation and the Mesh?

I hope that I have made my meaning clear, but if not I will gladly produce an example to illustrate what I am trying to accomplish.

Few lines of code might help understanding your problem
(in particular how you made the move).

S.

Thank you in advance
Rasmus Bach Nielsen







Archive powered by MHonArc 2.6.16.

Top of Page