Advent 2024: Day 5 (Epicycles Revisited)

Hi, Racket Discourse.

Just a quick one for today, since I have been swamped with work all of a sudden...

I reused some of my ideas from the year to make a snow globe!

The first part of the simulation is basically the same as the previous post I made about Fourier Transforms, but the extension allows for the particles to move dynamically.

The particle dynamics are simulated using semi-implicit Euler integration, which means we calculate the velocity at each timestep (under constant acceleration) and then calculate the updated position using the new velocity.

The reflections off the inside of the globe seem accurate enough, but I was just winging that section, really. So, take the calculations with a grain of salt.

Initially, I wanted the movements of the particles to be dependent on the armature of the epicycles, but I couldn't quite get the gravity right without fudging too much. I think it came out good, nonetheless.

I have pasted the code in a gist, although I am not too proud of what it looks like at present. Tread with caution, haha.

I had to break up the GIF to fit here, but the code for the chunking seems to cause the last number of bitmaps to not render properly, for some reason. To be continued.

0-merry-xmas
1-merry-xmas
2-merry-xmas
3-merry-xmas


Geseënde Kersfees vir almal. Mag die einde van die jaar salig wees en die nuwe jaar vir elkeen 'n avontuur of twee inhou!

8 Likes

thank you @bakgatviooldoos this looks awesome!

1 Like