3 ms·
> 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 determ
by yarcob 6y ago
> 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.