Example use of incident_cells?

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

Example use of incident_cells?

Adam Getchell
Hello all,

Is there an example on using OutputIterator CGAL::Triangulation_3< Traits, TDS, SLDS >::incident_cells(Vertex_handle v,OutputIterator cells )const to write all cells incident to vertex v?

I’m trying to do something like:

// Insert new vertex
Vertex_handle v_center = universe.triangulation->tds().insert_in_facet(
bottom, neighboring_31_index);

// Check that vertex is in center of 6 simplices
std::vector<Cell_handle> inc_cells;
universe.triangulation->tds().incident_cells(v_center, inc_cells);

(Where incident_cells() generates a few dozen lines of template errors.)

Reply | Threaded
Open this post in threaded view
|

Re: Example use of incident_cells?

andreas.fabri
Hello Adam,

Use std::back_inserter(inc_cells)

See also:
https://doc.cgal.org/latest/Manual/tutorial_hello_world.html

best,

andreas


On 11/14/2017 9:41 AM, Adam Getchell wrote:

> Hello all,
>
> Is there an example on using OutputIterator
> <https://doc.cgal.org/latest/Manual/classOutputIterator.html>
> CGAL::Triangulation_3
> <https://doc.cgal.org/latest/Triangulation_3/classCGAL_1_1Triangulation__3.html><
> Traits, TDS, SLDS >::incident_cells(Vertex_handle
> <https://doc.cgal.org/latest/Triangulation_3/classCGAL_1_1Triangulation__3.html#a1ba56e37b3a5acb1ba49a56d9d101a19> v,OutputIterator
> <https://doc.cgal.org/latest/Manual/classOutputIterator.html> cells )const
> to write all cells incident to vertex v?
>
> I’m trying to do something like:
>
> // Insert new vertex
> Vertex_handle v_center = universe.triangulation->tds().insert_in_facet(
> bottom, neighboring_31_index);
>
> // Check that vertex is in center of 6 simplices
> std::vector<Cell_handle> inc_cells;
> universe.triangulation->tds().incident_cells(v_center, inc_cells);
>
>
> (Where incident_cells() generates a few dozen lines of template errors.)
> --
> Adam Getchell
> https://keybase.io/adamgetchell
>

--
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


Reply | Threaded
Open this post in threaded view
|

Re: Example use of incident_cells?

MaelRL
In reply to this post by Adam Getchell
Hello,

You must provide an OuputIterator, so you can't directly pass "inc_cells"
since it is a container. You can use for example std::back_inserter() to
create an OutputIterator. That is:

  std::vector<Cell_handle> inc_cells;
  cells.reserve(64);
  universe.triangulation.incident_cells(v_center,
std::back_inserter(inc_cells));

Note that you also don't need to always go through the TDS: the
triangulation classes provide wrappers to most of the functions such as
incident_cells.



--
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


Reply | Threaded
Open this post in threaded view
|

Re: Example use of incident_cells?

Adam Getchell
Thank you!


On Nov 14, 2017, at 12:53 AM, Andreas Fabri <[hidden email]> wrote:

Hello Adam,

Use std::back_inserter(inc_cells)

See also:
https://doc.cgal.org/latest/Manual/tutorial_hello_world.html

best,

andreas

On Nov 14, 2017, at 12:54 AM, MaelRL <[hidden email]> wrote:

Hello,

You must provide an OuputIterator, so you can't directly pass "inc_cells"
since it is a container. You can use for example std::back_inserter() to
create an OutputIterator. That is:

 std::vector<Cell_handle> inc_cells;
 cells.reserve(64);
 universe.triangulation.incident_cells(v_center,
std::back_inserter(inc_cells));

Note that you also don't need to always go through the TDS: the
triangulation classes provide wrappers to most of the functions such as
incident_cells.



--
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