Triangulation_cell_base_with_info_3 - how to access the info?

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

Triangulation_cell_base_with_info_3 - how to access the info?

qp202
Hi, I'm using Triangulation_cell_base_with_info_3 so that I can augment cells
with more information, but reading the manual, it says:
"It provides an easy way to add some user defined information in cells. Note
that input/output operators discard this additional information."

This statement confuses me, as if input/output iterators discard this
additional information, does that mean I cannot access the extra information
when I am using Triangulation_cell_base_with_info_3 with for example a
hierarchical delaunay triangulation (as below)?

Setup:

typedef CGAL::Exact_predicates_inexact_constructions_kernel J;
typedef CGAL::Triangulation_cell_base_with_info_3<TetraInfo, J> Cb;
typedef CGAL::Triangulation_vertex_base_3<J> Vb;
typedef CGAL::Triangulation_hierarchy_vertex_base_3<Vb>  Vbh;
typedef CGAL::Triangulation_data_structure_3<Vbh, Cb>    Tds_info;
typedef CGAL::Delaunay_triangulation_3<J,Tds_info>      Dt_info;
typedef CGAL::Triangulation_hierarchy_3<Dt_info>      Dh_info;

typedef Dh_info::Finite_vertices_iterator Finite_vertices_iteratorI;
typedef Dh_info::Finite_cells_iterator  Finite_cells_iteratorI;
typedef Dh_info::Vertex_handle  Vertex_handleI;
typedef Dh_info::Point  PointI;
typedef Dh_info::Cell CellI;

Code:

//create triangulation
Dh_info dti;

//populate with points
        for (int i=0; i<vertex_positionsI.size(); ++i)
        {
            dti.insert(vertex_positionsI[i]);
        }

//output in geomview to confirm triangulation is successful
gv<<dti;

for (Finite_cells_iteratorI fit=dti.finite_cells_begin();
fit!=dti.finite_cells_end();++fit)
        {
           cout<<(*fit).info.in_model<<endl;  <------compile error here
        }

Compile error:

 [something really long] does not have class type

Tetrainfo, my info class, is just a simple class:
class TetraInfo{
 public:
TetraInfo();
bool in_model;
};

Can I simply not access my additional information through this method?
If not, how can I access my additional information?

Thanks for your help,
Qi
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Triangulation_cell_base_with_info_3 - how to access

Sylvain Pion
Administrator
Hi Qi !

[hidden email] a écrit :

> Hi, I'm using Triangulation_cell_base_with_info_3 so that I can augment cells
> with more information, but reading the manual, it says:
> "It provides an easy way to add some user defined information in cells. Note
> that input/output operators discard this additional information."
>
> This statement confuses me, as if input/output iterators discard this
> additional information, does that mean I cannot access the extra information
> when I am using Triangulation_cell_base_with_info_3 with for example a
> hierarchical delaunay triangulation (as below)?
>
> [...]
>
> for (Finite_cells_iteratorI fit=dti.finite_cells_begin();
> fit!=dti.finite_cells_end();++fit)
> {
>   cout<<(*fit).info.in_model<<endl;  <------compile error here

Try info() with the parenthesis ?
Did you find the the manual or the example program confusing about this?

"input/output operators" in the manual refer to the file reading
and writing routines.

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Triangulation_cell_base_with_info_3 - how to

qp202

Oh my god, sorry, I can't believe I didn't realise that it was a function! For some reason I'd had it engrained in my mind that the info object was contained inside the cell object...

Didn't realise there was an example program for this... is it in triangulation_2 or triangulation_3?

Thanks so much for your time - it probably would have taken me a day to realise that was what was wrong!

Cheers,

Qi


2009/3/13 Sylvain Pion <[hidden email]>
Hi Qi !

[hidden email] a écrit :
Hi, I'm using Triangulation_cell_base_with_info_3 so that I can augment cells
with more information, but reading the manual, it says:
"It provides an easy way to add some user defined information in cells. Note
that input/output operators discard this additional information."

This statement confuses me, as if input/output iterators discard this
additional information, does that mean I cannot access the extra information
when I am using Triangulation_cell_base_with_info_3 with for example a
hierarchical delaunay triangulation (as below)?

[...]

for (Finite_cells_iteratorI fit=dti.finite_cells_begin();
fit!=dti.finite_cells_end();++fit)
       {
          cout<<(*fit).info.in_model<<endl;  <------compile error here

Try info() with the parenthesis ?
Did you find the the manual or the example program confusing about this?

"input/output operators" in the manual refer to the file reading
and writing routines.

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss



--
Qi Pan
MCR President
Fitzwilliam College,
Cambridge, CB3 0DG
Tel: +44 (0) 1223 477061
Reply | Threaded
Open this post in threaded view
|

Re: Triangulation_cell_base_with_info_3 - how to

Laurent Rineau (GeometryFactory)
On Friday 13 March 2009 23:39:35 Qi Pan wrote:
> Oh my god, sorry, I can't believe I didn't realise that it was a function!
> For some reason I'd had it engrained in my mind that the info object was
> contained inside the cell object...


Actually, it *is* contained in the cell object. But its value is given by a function (the function actually gives a reference to the info, if I remmeber well). It is a basic encapsulation.


--
Laurent Rineau, PhD
Engineer at GeometryFactory
http://www.geometryfactory.com/