Subject: CGAL users discussion list
List archive
- From: Laurent Rineau <>
- To:
- Cc:
- Subject: Re: [cgal-discuss] Re: Cannot access to Polygon_2 points
- Date: Fri, 11 May 2007 11:30:36 +0200
- Organization: Inria, Sophia Antipolis, FRANCE
On Friday 11 May 2007 03:04:00
wrote:
> Ok i have founded the Vertex_iterator to access the vertex of the Polygon
>
>
> Vertex_iterator vertit;
>
> vertit = polygon.vertices_begin ();
> double x1 = vertit->x();
> double x2 = vertit->y();
>
>
> but the manual say into Polygon_2
>
> Point_2 pgn [ int i] Returns a (const) reference to the
> i-th
> vertex.
More precisely, the manual says:
----------------------------
Random access methods
These methods are only available for random access containers.
Point_2 pgn.vertex ( int i)
Returns a (const) reference to the i-th vertex.
Point_2 pgn [ int i]
Returns a (const) reference to the i-th vertex.
----------------------------
http://www.cgal.org/Manual/3.2/doc_html/cgal_manual/Polygon_ref/Class_Polygon_2.html
The important part is "only available for random access containers".
I had a look at your error messages, and the Container template parameter of
Polygon_2 was instantiated with a list. As the container do not have random
access iterators, you cannot have them at the polygon level either.
If you instantiate you polygon type like that: "CGAL::Polygon_2<Traits>",
that
is without specifying the Container parameter, the container will be a
std::vector, which has random access iterators.
--
Laurent Rineau
INRIA - Sophia Antipolis
BP 93, 2004 Route des Lucioles
06902 Sophia Antipolis Cedex FRANCE
- Cannot access to Polygon_2 points, asmprog32, 05/11/2007
- <Possible follow-up(s)>
- Re: Cannot access to Polygon_2 points, asmprog32, 05/11/2007
- Re: [cgal-discuss] Re: Cannot access to Polygon_2 points, Laurent Rineau, 05/11/2007
Archive powered by MHonArc 2.6.16.