Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] vector of points

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] vector of points


Chronological Thread 
  • From: Frédérik Paradis <>
  • To:
  • Subject: Re: [cgal-discuss] vector of points
  • Date: Sun, 22 May 2016 13:25:03 -0400
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:qoF2gxEZY6P7Z2hlizp1ap1GYnF86YWxBRYc798ds5kLTJ75o8mwAkXT6L1XgUPTWs2DsrQf27uQ6PCrADVaqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh7H0oM2YOlwSzBOGIppMbzyO5T3LsccXhYYwYo0Q8TDu5kVyRuJN2GlzLkiSlRuvru25/Zpk7jgC86l5r50IAu3GePEzQrVcSTgnKGso/9bDtB/ZTALJ6GFPfH8Rl09mGYnJbQv7Xd/JuzHzuutmkH2UJcTsROhpCRy/6Lt3QQDhziwOYW1quFrLg9B92foI6CmqoAZyltbZ

I never used the delaunay triangulation so I don't know if there is anything special with it. But, in the general case, if you want to modify a point, you could do something like that:

point[i] = Point_2(point[i].x() + 1, point[i].y())

if you wanted for instance to translate the point of 1 unit on the x-axis.

Frédérik


2016-05-22 13:12 GMT-04:00 parisa rahmani <>:
Thanks for the response.

Actually this code was just an example of what I'm going to do.
Because I want to make a delaunay triangulation, I must use an array(vector) of points, but later I want to manipulate the x and y of each point of the vector, how can I access them? in the case of one point it's: point.x() and point.y(), what about an array of points?  


On Sunday, May 22, 2016 9:34 PM, Frédérik Paradis <> wrote:


You have to use the copy constructor like this:
points[0] = Point_2(1.0, 1.0);
Frédérik
 

2016-05-22 12:52 GMT-04:00 parisa rahmani <>:

Hi every one. I'm new to CGAL.
I'm a little bit confused about using vector of points in CGAL.
how can I have access to x and y elements of Point_2, I mean :
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_2 Point_2;
typedef std::vector<Point_2> Vector;

Vector points;
points.reserve(5);

int main(){
points[0].x() =1.0;
points[0].y() =1.0;
return 0;}
points[i].x() or points[i].x produces error.

thanks
Parisa







Archive powered by MHonArc 2.6.18.

Top of Page