#ifndef POLYGON_HPP #define POLYGON_HPP #include "geometry.hpp" // One direction of a polygon edge that is shared between two or more // different polygon features, as identified by --no-simplification-of-shared-nodes, // in world coordinates. The list of these is sorted by `a` (y, then x) // and then by `b` (y, then x), and is used to avoid adding spindle strips // along edges that border other features, where they would overlap them. struct shared_edge { long long ax, ay; long long bx, by; }; extern shared_edge *shared_edges_map; extern size_t shared_edges_count; // Find the parts of a polygon (in world coordinates) that are narrower than // a pixel at zoom level z with the specified tile detail, and return strips // (in tile coordinates) covering the pixels along them. // // `simplification` is the simplification tolerance, in tile units, that the // geometry was simplified with, which is how far a simplified shared border // may have strayed from the original shared edges. (ox, oy) is the world // coordinate of the tile origin that the geometry is relative to. drawvec thin_polygon_strips(drawvec const &geom, int z, int detail, double simplification = 1, long long ox = 0, long long oy = 0); // Union the strips from thin_polygon_strips() with a cleaned polygon // (both in tile coordinates) drawvec union_polygon_strips(drawvec const &geom, drawvec const &strips); #endif