MCPcopy Create free account
hub / github.com/algorithm-archivists/algorithm-archive / main

Function main

contents/IFS/code/cpp/IFS.cpp:54–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54int main() {
55 // This will generate a Sierpinski triangle with a chaos game of n points for
56 // an initial triangle with three points on the vertices of an equilateral
57 // triangle.
58 PointVector inputPoints = {{0.0, 0.0}, {0.5, std::sqrt(0.75)}, {1.0, 0.0}};
59 auto outputPoints = chaosGame(10000, inputPoints);
60
61 // It will output the file sierpinski.dat, which can be plotted after
62 std::ofstream ofs("sierpinski.dat");
63 for (auto pt : outputPoints)
64 ofs << pt.x << '\t' << pt.y << '\n';
65}

Callers

nothing calls this directly

Calls 1

chaosGameFunction · 0.85

Tested by

no test coverage detected