Koch curve: Difference between revisions
Content deleted Content added
m Simplified code |
m Renamed constant |
||
Line 128:
#include <vector>
constexpr double
struct point {
Line 151:
output[j + 1].x = x0 + dx/3;
output[j + 1].y = y0 + dy/3;
output[j + 2].x = x0 + dx/2 - dy *
output[j + 2].y = y0 + dy/2 + dx *
output[j + 3].x = x0 + 2 * dx/3;
output[j + 3].y = y0 + 2 * dy/3;
Line 162:
std::vector<point> koch_points(int size, int iterations) {
double length = size *
double x = (size - length)/2;
double y = size/2 - length *
std::vector<point> points{
{x, y},
{x + length/2, y + length *
{x + length, y},
{x, y},
|