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

Function main

contents/barnsley/code/cpp/barnsley.cpp:107–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107int main() {
108
109 const std::array barnsley_hutchinson = {
110 Op{Row{0.0, 0.0, 0.0}, Row{0.0, 0.16, 0.0}, Row{0.0, 0.0, 1.0}},
111 Op{Row{0.85, 0.04, 0.0}, Row{-0.04, 0.85, 1.60}, Row{0.0, 0.0, 1.0}},
112 Op{Row{0.20, -0.26, 0.0}, Row{0.23, 0.22, 1.60}, Row{0.0, 0.0, 1.0}},
113 Op{Row{-0.15, 0.28, 0.0}, Row{0.26, 0.24, 0.44}, Row{0.0, 0.0, 1.0}}};
114
115 const std::array barnsley_probabilities = {0.01, 0.85, 0.07, 0.07};
116 auto output_points = chaos_game(
117 10'000, Vec2{0, 0}, barnsley_hutchinson, barnsley_probabilities);
118
119 std::ofstream ofs("out.dat");
120 for (auto pt : output_points)
121 ofs << pt[0] << '\t' << pt[1] << '\n';
122}

Callers

nothing calls this directly

Calls 1

chaos_gameFunction · 0.70

Tested by

no test coverage detected