Boost logo

Geometry :

Subject: [geometry] Errors in Voronoi basic tutorial
From: Darren Pearce-Lazard (darrenp_at_[hidden])
Date: 2016-02-12 05:04:25


Hi there,

Unless I am mistaken, I found a couple of errors in the basic tutorial (
http://www.boost.org/doc/libs/1_54_0/libs/polygon/doc/voronoi_basic_tutorial.htm
).

Firstly, 'point_traits' is used for the segment type instead of
'segment_traits'. Secondly, 'p1()' and 'p0()' should be simply 'p0' and
'p1'. So this code:

template <>
struct point_traits<Segment> {
  typedef int coordinate_type;
  typedef Point point_type;

  static inline coordinate_type get(const Segment& segment, direction_1d
dir) {
    return dir.to_int() ? segment.p1() : segment.p0();
  }
};

should be:

template <>
struct segment_traits<Segment> {
  typedef int coordinate_type;
  typedef Point point_type;

  static inline coordinate_type get(const Segment& segment, direction_1d
dir) {
    return dir.to_int() ? segment.p1 : segment.p0;
  }
};

Apologies if this has already been covered in another post.

])arren.



Geometry list run by mateusz at loskot.net