Coding Math: Episode 16 - Springs Part 2

preview_player
Показать описание
This time we build on the springs we created in Episode 15 to create some really amazing effects.

Рекомендации по теме
Комментарии
Автор

This is the basics behind a 'force directed graph layout' algorithm.

jimsmart
Автор

Use two particles attached to a point, and add collisions and gravity. Boob physics!

kevnar
Автор

This is indeed wicked pissah, thanks a lot Keith.

GuidoAmabili
Автор

This is so great! Thank you for sharing your knowledge!

MrTrollizator
Автор

Cant help but wonder why you didnt make a "draw" method in the particle object.

alekmoth
Автор

Hmm... "spring3.js" is not in the repo it seems. The only solution I could come up with to replicate the spring+gravity+collision is to add gravity to 2 of the particles, but not the 3rd. I thought that all particles would need springs between every other particle to kind of force any given particle away from BOTH of its neighbors. However, even doing that just had all three particles of the structure collapse to the bottom of the screen.

Without gravity, they show proper tension to form an equilateral triangle, but the inclusion of gravity on all particles doesn't maintain that when at rest on the "ground". Removing gravity from one particle kept the 3-sided tension again, but somehow this doesn't feel "accurate" to me. And in fact, in running multiple simulations I see strange artifacts where the non-gravity particle is below the other two and gets "forced up" to the top of the resting structure by its separation value.

This may (?) be a limitation of the particle system at this stage of its development, but I cannot check the repo to verify my answer.

ChristopherDrum