#include <cstdlib>
#include <ctime>
#include <iostream>
#include <fstream>
#include <cmath>
#include <vector>
#include <utility>
if ( depth > 0 ) {
Point a = p1 + ( v / 3.0 );
Point b = p1 + 2 * ( v / 3.0 );
Koch( curve, p1, a, depth-1 );
Koch( curve, a, c, depth-1 );
Koch( curve, c, b, depth-1 );
Koch( curve, b, p2, depth-1 );
} else {
curve << p2;
}
}
int main( int , char *[] )
{
Shape::disableLineWidthScaling();
Polyline curve(
true,Color::Null,Color::Green,0.0,Shape::SolidStyle,Shape::RoundCap,Shape::RoundJoin);
const int recursions = 5;
Koch( curve, a, b, recursions );
Koch( curve, b, c, recursions );
Koch( curve, c, a, recursions );
board << curve;
board.
saveFIG(
"koch.fig", 200, 200 );
board.
saveEPS(
"koch.eps", Board::A4 );
board.
saveSVG(
"koch.svg", Board::BoundingBox, 0.0, Board::UCentimeter );
}