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

Function main

contents/barnsley/code/rust/barnsley.rs:67–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65}
66
67fn main() {
68 let barnsley_hutchinson = vec![
69 vec![
70 Point3::new(0.0, 0.0, 0.0),
71 Point3::new(0.0, 0.16, 0.0),
72 Point3::new(0.0, 0.0, 1.0),
73 ],
74 vec![
75 Point3::new(0.85, 0.04, 0.0),
76 Point3::new(-0.04, 0.85, 1.60),
77 Point3::new(0.0, 0.0, 1.0),
78 ],
79 vec![
80 Point3::new(0.20, -0.26, 0.0),
81 Point3::new(0.23, 0.22, 1.60),
82 Point3::new(0.0, 0.0, 1.0),
83 ],
84 vec![
85 Point3::new(-0.15, 0.28, 0.0),
86 Point3::new(0.26, 0.24, 0.44),
87 Point3::new(0.0, 0.0, 1.0),
88 ],
89 ];
90
91 let barnsley_probabilities = vec![0.01, 0.85, 0.07, 0.07];
92
93 let mut out = String::new();
94
95 for point in chaos_game(
96 10_000,
97 Point2 { x: 0.0, y: 0.0 },
98 &barnsley_hutchinson,
99 &barnsley_probabilities,
100 ) {
101 out += format!("{}\t{}\n", point.x, point.y).as_str();
102 }
103
104 std::fs::write("./out.dat", out).unwrap();
105}

Callers

nothing calls this directly

Calls 1

chaos_gameFunction · 0.70

Tested by

no test coverage detected