1 unstable release

0.1.0 Dec 30, 2024

#758 in Algorithms

Download history 88/week @ 2024-12-25 24/week @ 2025-01-01

112 downloads per month
Used in uscope

MIT/Apache

58KB
995 lines

🦠 Cytogon

License: MIT or Apache 2.0 Doc Crate

🦠 Cytogon — A mesh generation library based on cellular automata.

Overview

🦠 Cytogon allows generating 2D and 3D meshes from cellular automata.

// Create a 128³ grid and randomly fill it at 60%
let mut cave = Grid3::new(UVec3::new(128, 128, 128));
cave.fill_rand(0.6, rand::thread_rng());

// CA rule: 13-26/13-14,17-19/2/M
let rule = Rule3 {
    birth: RuleBitset3::from(13u8..=14u8) | (17u8..=19u8).into(),
    survive: (13u8..=26u8).into(),
};

// Iteratively apply the cellular automaton rule 5 times
for _ in 0..5 {
    cave.smooth(&rule);
}

For a viewer (GUI), see the 🔬 μscope repository (📦uscope crate).

Dependencies

~4MB
~126K SLoC