1+ // Hide console window on Windows in release builds
2+ #![ cfg_attr( not( debug_assertions) , windows_subsystem = "windows" ) ]
3+
14mod viewer_2d;
25mod viewer_3d;
36
@@ -8,6 +11,7 @@ fn main() -> eframe::Result {
811 let options = eframe:: NativeOptions {
912 viewport : egui:: ViewportBuilder :: default ( )
1013 . with_inner_size ( [ 1280.0 , 800.0 ] )
14+ . with_position ( [ 200.0 , 50.0 ] )
1115 . with_title ( "Complex Systems Visualizer" ) ,
1216 ..Default :: default ( )
1317 } ;
@@ -42,9 +46,15 @@ impl ComplexSystemsApp {
4246 Box :: new( julia:: Julia :: new( ) ) ,
4347 Box :: new( burning_ship:: BurningShip :: new( ) ) ,
4448
45- // Cellular Systems
49+ // Cellular Systems & Emergent Complexity
4650 Box :: new( game_of_life:: GameOfLife :: new( ) ) ,
4751 Box :: new( cellular_automaton:: CellularAutomaton :: new( 30 ) ) ,
52+ Box :: new( langtons_ant:: LangtonsAnt :: new( ) ) ,
53+ Box :: new( cyclic_ca:: CyclicCA :: new( ) ) ,
54+
55+ // Growth & Self-Organization
56+ Box :: new( dla:: DLA :: new( ) ) ,
57+ Box :: new( sandpile:: Sandpile :: new( ) ) ,
4858
4959 // Animated Simulations
5060 Box :: new( double_pendulum:: DoublePendulum :: new( ) ) ,
@@ -59,9 +69,22 @@ impl ComplexSystemsApp {
5969 Box :: new( generative:: Boids :: new( ) ) ,
6070 Box :: new( generative:: DeJongAttractor :: new( ) ) ,
6171 Box :: new( generative:: CliffordAttractor :: new( ) ) ,
72+
73+ // Complex Emergent Simulations
74+ Box :: new( slime_mold:: SlimeMold :: new( ) ) ,
75+ Box :: new( falling_sand:: FallingSand :: new( ) ) ,
6276 ] ;
6377
6478 let simulations_3d: Vec < Simulation3DBox > = vec ! [
79+ // Stunning 3D Visualizations
80+ Box :: new( dna_helix:: DNAHelix :: new( ) ) ,
81+ Box :: new( torus_knot:: TorusKnot :: new( ) ) ,
82+ Box :: new( galaxy_spiral:: GalaxySpiral :: new( ) ) ,
83+
84+ // Enhanced Particle Systems
85+ Box :: new( particle_attractor_3d:: ParticleAttractor3D :: new( ) ) ,
86+ Box :: new( boids_3d:: Boids3D :: new( ) ) ,
87+
6588 // Classic Attractors
6689 Box :: new( lorenz:: LorenzAttractor :: new( ) ) ,
6790 Box :: new( rossler:: RosslerAttractor :: new( ) ) ,
@@ -72,6 +95,16 @@ impl ComplexSystemsApp {
7295 Box :: new( dadras:: DadrasAttractor :: new( ) ) ,
7396 Box :: new( thomas:: ThomasAttractor :: new( ) ) ,
7497 Box :: new( chen:: ChenAttractor :: new( ) ) ,
98+
99+ // Diverse Particle Simulations
100+ Box :: new( nbody_gravity:: NBodyGravity :: new( ) ) ,
101+ Box :: new( fluid_sph:: FluidSPH :: new( ) ) ,
102+ Box :: new( magnetic_field:: MagneticField :: new( ) ) ,
103+
104+ // Radical 3D Animations
105+ Box :: new( vortex_turbulence:: VortexTurbulence :: new( ) ) ,
106+ Box :: new( lightning_bolt:: LightningBolt :: new( ) ) ,
107+ Box :: new( fractal_tree_3d:: FractalTree3D :: new( ) ) ,
75108 ] ;
76109
77110 Self {
@@ -112,6 +145,45 @@ impl eframe::App for ComplexSystemsApp {
112145
113146 ui. separator ( ) ;
114147
148+ // Global scale/zoom controls
149+ match self . sim_type {
150+ SimulationType :: TwoD => {
151+ ui. horizontal ( |ui| {
152+ ui. label ( "🔍 Pattern Detail:" ) ;
153+ if ui. add ( egui:: Slider :: new ( & mut self . viewer_2d . scale , 0.25 ..=2.0 )
154+ . text ( "Scale" ) ) . changed ( ) {
155+ self . viewer_2d . needs_update = true ;
156+ // Reset pan when scale changes to prevent shift
157+ self . viewer_2d . pan_x = 0.0 ;
158+ self . viewer_2d . pan_y = 0.0 ;
159+ }
160+ if ui. button ( "Reset Scale" ) . clicked ( ) {
161+ self . viewer_2d . scale = 1.0 ;
162+ self . viewer_2d . needs_update = true ;
163+ self . viewer_2d . pan_x = 0.0 ;
164+ self . viewer_2d . pan_y = 0.0 ;
165+ }
166+ if ui. button ( "Reset Pan" ) . clicked ( ) {
167+ self . viewer_2d . pan_x = 0.0 ;
168+ self . viewer_2d . pan_y = 0.0 ;
169+ }
170+ } ) ;
171+ ui. label ( format ! ( "📐 Resolution: {}x{} pixels" ,
172+ ( 800.0 * self . viewer_2d. scale) as i32 ,
173+ ( 600.0 * self . viewer_2d. scale) as i32 ) ) ;
174+ ui. label ( "💡 Tip: Drag to pan when zoomed" ) ;
175+ }
176+ SimulationType :: ThreeD => {
177+ ui. horizontal ( |ui| {
178+ ui. label ( "🔍 View Zoom:" ) ;
179+ ui. add ( egui:: Slider :: new ( & mut self . viewer_3d . zoom , 0.5 ..=5.0 )
180+ . text ( "Zoom" ) ) ;
181+ } ) ;
182+ }
183+ }
184+
185+ ui. separator ( ) ;
186+
115187 egui:: ScrollArea :: vertical ( ) . show ( ui, |ui| {
116188
117189 match self . sim_type {
@@ -162,7 +234,7 @@ impl eframe::App for ComplexSystemsApp {
162234 egui:: CentralPanel :: default ( ) . show ( ctx, |ui| {
163235 match self . sim_type {
164236 SimulationType :: TwoD => {
165- self . viewer_2d . show ( ui, & self . simulations_2d [ self . sim_2d_index ] ) ;
237+ self . viewer_2d . show ( ui, & mut self . simulations_2d [ self . sim_2d_index ] ) ;
166238 }
167239 SimulationType :: ThreeD => {
168240 let dt = ui. input ( |i| i. stable_dt ) ;
0 commit comments