Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Polygon_2::Vertex_const_iterator reports wrong first vertex

Subject: CGAL users discussion list

List archive

[cgal-discuss] Polygon_2::Vertex_const_iterator reports wrong first vertex


Chronological Thread 
  • From: Thomas Kluth <>
  • To:
  • Subject: [cgal-discuss] Polygon_2::Vertex_const_iterator reports wrong first vertex
  • Date: Tue, 20 Jan 2015 02:24:45 -0800 (PST)

Dear CGAL-Team,

I think I found a bug in the Polygon_2::Vertex_const_iterator.
I've attached a minimal working example that you should be able to compile
and run with

cmake .
make
./polytest

You should see this output:

cgal version: 4.5.1
Polygon: Polygon_2(
PointC2(10, 20)
PointC2(10, 40)
PointC2(50, 20)
)

first vertex: PointC2(10, 20)

vertices of the polygon from Printer.hhp:
CGAl Point: PointC2(0, 20)
raw coordinates: 0, 20
CGAl Point: PointC2(10, 40)
raw coordinates: 10, 40
CGAl Point: PointC2(50, 20)
raw coordinates: 50, 20
first vertex again:
CGAl Point: PointC2(10, 20)
raw coordinates: 10, 20

The bug here is that Polygon_2::Vertex_const_iterator gives a wrong value of
the x-value of the first vertex of the polygon in Printer.hpp, but not in
MyPolygon.hpp (0 instead of 10).
Furthermore, the same call of polygon.vertices_begin() gives a different
output in the Printer.hpp. Please look to the attached code to understand
the failure.

The output was generated with CGAL 4.5.1 on Fedora 21, the version that is
in the repository. I had similar prolems with CGAL 4.4.x on Fedora 20.
Interestingly, the bug does _not_ happen with the same code and CGAL 4.5 on
Mac OS X 10.7.5, installed via homebrew.

It might be that I just have to little knowledge about objects, classes and
CGAL and this is not a bug but actually I did a mistake.
If this is the case I would be happy to know, how to pass CGAL-Objects from
one object to another object correctly.
Otherwise I'm asking you to fix the bug.

Thank you!
Thomas Kluth

P.S.: It might be that my example is not minimal, but it reflects the way I
use CGAL in my bigger project. cgalbug.zip
<http://cgal-discuss.949826.n4.nabble.com/file/n4660327/cgalbug.zip>



--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Polygon-2-Vertex-const-iterator-reports-wrong-first-vertex-tp4660327.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page