Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] How to move a Point

Subject: CGAL users discussion list

List archive

[cgal-discuss] How to move a Point


Chronological Thread 
  • From: "[cristo]" <>
  • To:
  • Subject: [cgal-discuss] How to move a Point
  • Date: Wed, 17 Feb 2010 14:57:18 -0600
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=uzmfRcUxcfjBK2+kUUDzEJ5dacqekkKyI2xlMx5jannczn40QjaT5TJ7+QD4BdPCT1 1gnxNT9mZ1vBLfUM/pWOvuN5pBrHoVZqrU6nROK77Es4b0ChZ7gGBZT+hBrHR0YE4x9e lysk4NAwrre/GbCEt8PYpnvQwK3jLQ1rUv+eg=

Hello all,

While trying to understand how the 2D and 3D Kernel works I found that Point_2 and Point_3 clases do not allow to modify its coordinates, so if I want to move a Point I would have to do something like:

  typedef CGAL::Cartesian<double> K;
  typedef K::Point_2 Point_2;
  typedef K::Vector_2 Vector_2;

  Point_2 my_Point(0,0);
  Vector_2 d(1,2);

  my_point = my_point + d;

According to the documentation, + and - operators return a Point obtained by translating the point my_point by the vector d. Regarding this behaviour I have the following questions:

 - Each time the +,- operators are used a new Point is created?
 - Searching through cgal's source code I couldn't find the implementation of this operators, but I found that some clases have what the comments on the code itself calls a "reference count" to "reduce time when making copies". How does this work?

Thanks in advance


  • [cgal-discuss] How to move a Point, [cristo], 02/17/2010

Archive powered by MHonArc 2.6.16.

Top of Page