I am constructing a simulation of point particles and using CGAL Delaunay
triangulation to determine the particle neighbors. In my implementation each vertex has extra info corresponding to (unsigned int) particle index. When not using periodic boundaries it works. When I then try to switch to periodic boundaries I have a problem. The initial Delaunay Triangulation is OK, but when I try to use move_if_no_collision or move_point I get unexpected behaviour. Here is the code I'm using: #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Periodic_2_Delaunay_triangulation_2.h> #include <CGAL/Periodic_2_Delaunay_triangulation_traits_2.h> #include <CGAL/Triangulation_vertex_base_with_info_2.h> typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Periodic_2_Delaunay_triangulation_traits_2<Kernel> GT; typedef CGAL::Periodic_2_triangulation_vertex_base_2<GT> Vb; typedef CGAL::Triangulation_vertex_base_with_info_2<unsigned int, GT, Vb> VbInfo; typedef CGAL::Periodic_2_triangulation_face_base_2<GT> Fb; typedef CGAL::Triangulation_data_structure_2<VbInfo, Fb> Tds; typedef CGAL::Periodic_2_Delaunay_triangulation_2<GT, Tds> Delaunay; typedef Delaunay::Point CGAL_Point; typedef Delaunay::Vertex_handle Vertex; Delaunay Dtriangulation; Dtriangulation.insert(particlesNormTriangData.begin(), particlesNormTriangData.end()); generateDelaunayVerticesHandlesVector(); //This function generates the vector VerticesHandlesVector that holds handles to vertices Vertex v=VerticesHandlesVector[particle->get_Index()]; //Here are two ways I tried to change vertex position in my code: Vertex test_v = Dtriangulation.move_if_no_collision(v, newPosition); //alternative option: Dtriangulation.move_point(v, newPosition); When I apply one of these functions to a vertex, it changes the info of the vertex to be 3435973836 (seems to be always the same value). Specifically when using move_if_no_collision function, it returns a different vertex handle which is supposed to indicate that the new position overlaps with an existing vertex. This is however not the case. {I checked this for example by using the nearest_vertex() function before applying the move (with the new position as input). The nearest vertex to the new position is the vertex that's being moved (since it's a small displacement).} Here is the working code for the non periodic case: #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Delaunay_triangulation_2.h> #include <CGAL/Triangulation_vertex_base_with_info_2.h> typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Triangulation_vertex_base_with_info_2<unsigned int, Kernel> Vb; typedef CGAL::Triangulation_data_structure_2<Vb> Tds; typedef CGAL::Delaunay_triangulation_2<Kernel, Tds> Delaunay; typedef Kernel::Point_2 CGAL_Point; typedef Delaunay::Vertex_handle Vertex; Delaunay Dtriangulation; Dtriangulation.insert(particlesNormTriangData.begin(), particlesNormTriangData.end()); generateDelaunayVerticesHandlesVector(); //This function generates the vector VerticesHandlesVector that holds handles to vertices Vertex test_v = Dtriangulation.move_if_no_collision(v, newPosition); Can any one help me figure out what's wrong? -- Sent from: http://cgal-discuss.949826.n4.nabble.com/ -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss |
Another clue.
I i change the vertex info type to int instead of unsigned int I get that the index of the vertices changes to -858993460 -- Sent from: http://cgal-discuss.949826.n4.nabble.com/ -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss |
In reply to this post by yoapvol
After opening an issue in github, I was informed that the move functions are
broken. A solution was offered of using insert function and then remove function. See full details here: https://github.com/CGAL/cgal/issues/3239#issuecomment-405868378 <https://github.com/CGAL/cgal/issues/3239#issuecomment-405868378> -- Sent from: http://cgal-discuss.949826.n4.nabble.com/ -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss |
Free forum by Nabble | Edit this page |