Date: 03-12-2019
Buoyancy
Since we touched upon the concept of buoyancy last class, I wanted to delve a little bit into that, as we didn’t really look into it in class. My intention is to inspire us on how to better implement buoyancy in our codes.
The essential reason why buoyancy exists is that the amount of water pressure differs on different levels in the water. When an object is wholly immersed in fluid, the fluid exerts pressure on both its upper and lower surfaces. Pressure upon the upper surface is downwards, while that upon its lower surface is upwards and bigger than the former, hence the buoyancy being upwards. That’s the basic principle of how buoyancy works.
Essentially, in a certain type of fluid, whether an object floats or not is determined by their density. If the fluid has bigger density, the object floats, and vice versa. If the object has the same density as the fluid, it suspends in the fluid (can stay static at any level in the fluid).
If we would like water in the physical environment we creates in p5, buoyancy is something we have to think about. In my opinion, the simplest and most accurate solution is to add density to objects. With the density and size of an object, we calculate its mass. The buoyancy that water exerts upon it is determined by its size – they have a positive correlation; its mass directly determines how much gravity there is. By adding the two vectors together – gravity and buoyancy, we’ll know whether the object should float or sink.