## Love at frost sight!

With spooky season being over and the jolly season looming around the corner, everyone is trying to find out if they are naughty or nice.

Christmas had us feeling extra Santa-mental and to end up in the right array we decided to let it snow, let it snow, let it snow.

You snow the drill! We started by researching how snow forms which turned out to be much more complicated than we expected. But we are (s)elf-taught and this did not scare us away.

## This is snow laughing matter!

In a nut shell, snowflakes grow around an initial seed (whatever that may be) which tends to be symmetric. Water molecules will bond to the growing seed at preferential points. For example, molecules like to be attached to edges but do not like to be stuck onto walls. Overall redial symmetry is created since the snowflake is so small that external factors are identical all over (think of this as all the branches have the same starting random seed)

To simulate this we went with a Monte-Carlo style simulation. We start by creating some random points and then adding random points one at a time evaluating their likelihood of being in that position (we are more likely to accept the high probability points). Clearly the figuring out this probability function is what gives the snowflake the shape!

## But at what cost?

The initial cost function simply preferred points that only had 1 neighbor as we thought this would be enough to detect edges. However, we quickly realized that this was not enough to create the branching structure expected from edges. To fix this problem we computed the probability as the reciprocal of the residuals of linear fit on the N nearest neighbors. This preferentially created points that form lines and thus gave the grid structure we expect from first principles.

Recalling that the basic symmetry for real snowflakes comes from the symmetry of the seed we recreate this by only "growing" on sector and then reflecting it around. (the alternative is to create the same random pattern for all sectors but this is computationally wasteful)

## Visualizer? I barely know'er!

To create a nice visualization system for the snow flakes we designed a node.js website which simulates how the algorithm works by rendering the parts of the snowflake as the algorithm spawns them in.

In parallel, we used a raytracing algorithm to create renders of the snowflakes!

## Alternate Universe?

We also worked on an alternative algorithm which uses cellular automata which deterministically generates snowflakes on a hexagonal grid. This generated realistic looking snowflakes but lost the nail-biting appeal of the Monte-Carlo algorithm

Cool Video