57 const bool centerfilledp)
69 const double hex_width = 2.0 * r;
72 const double hex_height = std::sqrt(3.0) * r;
78 { hex_width / 2.0, hex_height },
79 { -hex_width / 2.0, hex_height },
81 { -hex_width / 2.0, -hex_height },
82 { hex_width / 2.0, -hex_height }
86 std::queue<point_2t> q;
87 std::unordered_set<point_2t, PointHash, PointEqual> visited;
93 hexagons.push_back(origin);
95 visited.insert(origin);
98 for (
uint i = 0; i < directions.size() && hexagons.size() < n; i++)
100 const auto& movement = directions[i];
101 auto [dx, dy] = movement;
102 point_2t neighbor = { x + dx, y + dy };
104 visited.insert(neighbor);
105 hexagons.push_back(neighbor);
109 while (hexagons.size() < n && !q.empty())
114 auto [current_x, current_y] = current;
117 for (
const auto& dir : directions)
120 point_2t neighbor = {current_x + dx, current_y + dy};
123 if (visited.find(neighbor) == visited.end()
124 && hexagons.size() < n)
126 visited.insert(neighbor);
127 hexagons.push_back(neighbor);
vrange radiate_hexagon_honeycomb(const point_2t origin, const double r, const uint n, const bool centerfilledp)
Compute set of points for a radial fill of hexograms centered at p.
std::tuple< space_type, space_type > point_2t
Point (x,y) in 2D space, space_type defaults to double.
vspace get_honeycomb_angles(const point_2t origin, const vrange &hexagons, const bool degreesp=true)
Compute set of angles, given points for a radial fill of hexograms centered at p.