Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Duplicate points in Arrangment

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Duplicate points in Arrangment


Chronological Thread 
  • From: Efi Fogel <>
  • To:
  • Subject: Re: [cgal-discuss] Duplicate points in Arrangment
  • Date: Sun, 5 Feb 2012 17:48:33 +0200

See my answer inline.

On Sun, Feb 5, 2012 at 4:49 PM, Winnie Hellmann <> wrote:
> In an arrangement you cannot have more than one feature with the same
> geometric embeddings. For example, a given point is associated with at most
> one vertex.
Well, that's what I thought. But for the following code...

 std::cout << arrangement.number_of_vertices() << std::endl;

 arrangement.insert_in_face_interior(CGAL::Point_2<Kernel>(1, 10),
arrangement.unbounded_face());

 std::cout << arrangement.number_of_vertices() << std::endl;

 arrangement.insert_in_face_interior(CGAL::Point_2<Kernel>(1, 10),
arrangement.unbounded_face());

 std::cout << arrangement.number_of_vertices() << std::endl;

... I get 0, 1, and 2 as output. So there seem to be two vertices at (1,
10). Is this a bug?

Yes, yours. arr.insert_in_face_interior(x) can be used under the severe restriction that x does not intersect with an existing feature.
If you are in doubt, use CGAL::insert_point(p).
If you need to know whether p collides with an existing vertex or lie on an existing curve, locate p beforehand using some point-location strategy.


I tested the code with following definitions:

#include <CGAL/Arr_linear_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Cartesian.h>
#include <CGAL/Gmpq.h>

struct FaceData
{
...
};

typedef CGAL::Gmpq Number;
typedef CGAL::Cartesian<Number> Kernel;
typedef CGAL::Arr_linear_traits_2<Kernel> Traits_2;
typedef CGAL::Arr_face_extended_dcel<Traits_2, FaceData> Dcel;
typedef CGAL::Arrangement_2<Traits_2, Dcel> Arrangement_2;

Arrangement_2 arrangement;

> Using an Observer you can intercept all attempts to insert a point or a
> curve into an arrangement that has already a feature (i.e., a vertex or an
> edge) associated with the point or curve.
That was my question: How do I find out that there is already a vertex
with the same coordinates? (without checking all the vertices)




Archive powered by MHonArc 2.6.16.

Top of Page