tomilov / sweepline

Fortune's algorithm for Voronoi diagram generating on the plane. Intended for runtime speed and careful handling of corner cases.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sweepline

Fortune's algorithm for Voronoi diagram generating on the plane. Intended for runtime speed and careful handling of corner cases.

How to use:

    using value_type = double;
    struct point 
    { 
        value_type x, y; 
        bool operator < (point const & p) const
        { return std::tie(x, y) < std::tie(p.x, p.y); }
    };
    using points = std::vector< point >;
    using site = typename points::const_iterator;
    using sweepline_type = sweepline< site, point, value_type >;
    sweepline_type sweepline_{eps};
    points points_;
    // fill points_ with data
    std::sort(std::begin(points_), std::end(points_));
    sweepline_(std::cbegin(points_), std::cend(points_));
    // sweepline_.vertices_ - resulting vertices
    // sweepline_.edges_ - resulting edges

About

Fortune's algorithm for Voronoi diagram generating on the plane. Intended for runtime speed and careful handling of corner cases.


Languages

Language:C++ 94.2%Language:CMake 4.3%Language:Shell 1.5%