eureka
experiment 028 · classical mechanics

Buoyancy & Stability

"Eureka!" — Archimedes' legendary exclamation upon discovering that a body immersed in fluid experiences an upward force equal to the weight of the fluid displaced. Yet, calculating that force for an arbitrarily rotated convex polygon, and determining if it will float upright or capsize, requires exact geometric intersections. Here, the Sutherland-Hodgman algorithm computes the submerged cross-section on every frame, driving a rigid-body solver where fluid pressure acts continuously to restore equilibrium.

The equations

The principle of buoyancy states that the buoyant force $F_B$ acting on an object is equal to the weight of the displaced fluid.

$$ F_B = \rho_{\text{fluid}} V_{\text{sub}} g $$

In our 2D simulation, $V_{\text{sub}}$ represents the exact 2D area of the submerged portion of the polygon. The center of buoyancy (CoB) is the geometric centroid of this submerged area.

If the center of gravity (CoG) and the center of buoyancy are not vertically aligned, a torque $\tau$ is generated, which tends to rotate the object to a stable equilibrium:

$$ \tau = (x_{\text{CoB}} - x_{\text{CoG}}) \times F_B $$

Polygon Clipping (Sutherland-Hodgman)

To continuously compute the submerged area as the body rotates and translates, we must intersect the arbitrary polygon with the water surface (a half-plane). The Sutherland-Hodgman algorithm is used here. It works by testing each edge of the subject polygon against the clipping edge (the water line).

If an edge crosses the water line, we calculate the exact point of intersection and add it to our new "submerged polygon". Then, standard formulas (based on Green's theorem) give us the exact area and centroid of this dynamically generated shape.

Metacentric Stability

Why does a long plank float perfectly flat, while a square block of density 0.5 prefers to float diagonally? This is determined by the metacenter.

When an object tilts slightly, its center of buoyancy shifts. If the vertical line drawn upwards from the new CoB intersects the object's vertical centerline above its center of gravity, the object is stable. This intersection point is the metacenter. If the metacenter is below the CoG, the object will capsize until it finds a stable orientation. For a square with density 0.5, the metacenter is actually below the CoG when it is flat, making the diagonal orientation the only stable one!

← back to workshop