News for hackers. Stuff that matters.
Re:Draw an iceberg and see how it would float in water by yarcob on Saturday February 20, 2021 @05:16AM (#26203086)
> Do you have a notion of how the code actually computes bouyancy?

Weight force (downward) is determined by the full polygon.

Buyancy force (upward) is determined by the part below the water line.

Lateral/angular motion results from the fact that the forces act on the centroids of the full polygon vs the centroid of the submerged polygon.

The script seems to use a JS library named "turf" to clip the polygon at the water line. Here's the line in the source:

var pp = turf.bboxClip(p, [-Infinity, yZero, Infinity, Infinity]).geometry.coordinates[0];

As far as I can tell, yZero is the water line, and pp is the part of the polygon that is submerged.

Re:Draw an iceberg and see how it would float in water by sgtnoodle on Saturday February 20, 2021 @05:53AM (#26203224)
Lol, thanks for the info. I was able to engineer an iceberg-boat. The boat is low mass but high bouyancy. If it were to be fully submerged, it would remain partially sunk.

https://ibb.co/T1KG5DM

Re:Draw an iceberg and see how it would float in water by yarcob on Saturday February 20, 2021 @08:58AM (#26204106)
That's brilliant!