🧊 Iceberg Floating Physics (2D)
2D Archimedes'-principle lab: adjustable ice and water density sliders binary-search a jagged iceberg cross-section's equilibrium waterline live, with a readout of submerged fraction, mass, buoyant force and displaced volume.
The 3D version of this scene bobs a low-poly iceberg at a fixed, hard-coded waterline for visual effect. This 2D companion turns that into an actual working lab: the jagged ice cross-section is treated as a polygon, and a binary search over trial waterline heights finds the exact level where the submerged area (measured with the shoelace formula on the clipped polygon) matches the ratio of ice density to water density — the same equilibrium condition Archimedes described, solved geometrically rather than assumed. Move the density sliders and watch the line actually move: glacier ice in fresh water settles noticeably higher than the same ice in denser seawater, and the live readout translates the geometry into mass, buoyant force, weight and displaced volume so the numbers back up what the eye sees.
2D Archimedes'-principle lab: adjustable ice and water density sliders binary-search a jagged iceberg cross-section's equilibrium waterline live, with a readout of submerged fraction, mass, buoyant force and displaced volume.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install