// SPDX-License-Identifier: LGPL-3.0-or-later #pragma once #include "tool_base.h" #include #include // Return the points of a regular n-gon // with the centre at (x, y) // that is modified in the sense that it takes rf, // which is used to set the radius for each individual point. // It is rotated by base_angle, // where 0 starts drawing at the top. std::vector> regular_polygon_mod(int n, std::function rf, int x = 0, int y = 0, float base_angle = 0); // Return the points of a star // with n spikes, // the inner radius r1, // the outer radius r2 // and the centre (x, y), // rotated by base_angle. std::vector> star(int n, float r1, float r2, int x = 0, int y = 0, float base_angle = 0); class star_tool : public tool_base { public: star_tool(canvas_buffer &canvas); void draw(int x0, int y0, int x1, int y1); void set_text(std::stringstream &stream); void set_spikes(int spikes); void set_radius_factor(int radius_factor); private: int spikes = 5; float radius_factor = 1.0 / 3.0; };