Obtain Vertex_handle from compact container of vertices

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Obtain Vertex_handle from compact container of vertices

Adam Getchell
Hello all,

In Triangulation_data_structure_3.h, I am using the vertices() method to obtain a reference to the compact container of vertices in the triangulation.

I’m attempted to obtain from that Vertex_handles on the items in the container, so that I can iterate through them and test for the infinite vertex using the is_infinite(Vertex_handle v) method.

Reading the documentation on CGAL::Compact container seems to imply that one can obtain an iterator of T from the container, but if I obtain the first element of the CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_3, …> I cannot successfully cast it to a Vertex_handle via static_cast.

The debugger shows that I have a pointer to the element, but I cannot dereference it successfully.

Here’s a short self-contained example of what I’m attempting:


Thanks for any advice.
-- 
Adam Getchell
https://dev.to/acgetchell



Reply | Threaded
Open this post in threaded view
|

Re: Obtain Vertex_handle from compact container of vertices

Marc Glisse
On Sat, 12 Oct 2019, Adam Getchell wrote:

> In Triangulation_data_structure_3.h, I am using the vertices() method to obtain a reference to the compact container of vertices in the triangulation.

By writing

   auto vertices = dt.tds().vertices();

you are actually making a copy of it, which I believe is the source of
your trouble. Writing auto& or auto&& should help.

--
Marc Glisse

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Obtain Vertex_handle from compact container of vertices

Adam Getchell
Marc,

That’s it exactly!

Thank you!

-- 
Adam Getchell
https://dev.to/acgetchell



On Oct 12, 2019, at 1:49 PM, Marc Glisse <[hidden email]> wrote:

On Sat, 12 Oct 2019, Adam Getchell wrote:

In Triangulation_data_structure_3.h, I am using the vertices() method to obtain a reference to the compact container of vertices in the triangulation.

By writing

 auto vertices = dt.tds().vertices();

you are actually making a copy of it, which I believe is the source of your trouble. Writing auto& or auto&& should help.

--
Marc Glisse

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss