cloth
Adds a sheet of columns by rows particles spacing apart, its top-left particle at (left, top), and returns it.
Structural links along the rows and columns keep it from stretching (compliance); shear links across every square keep the squares square (shearCompliance); bends along the rows and columns keep it from creasing (bendCompliance, or none at all for NaN). The particles pinned returns true for are static, by default the whole top row, so it hangs like a curtain. Links stretched past tearAt times their rest length break, and a bend across a broken link goes with it, so it tears cleanly. Pass the arguments after top by name.
Throws
if the sheet is smaller than 2 by 2, left or top is not finite, spacing is not finite and more than 0, any placed link has length not finite and more than 0, mass is not more than 0, radius is negative, compliance, shearCompliance or a non-NaN bendCompliance is negative or not finite, or tearAt is neither 0 nor more than 1.
Samples
val world = PhysicsWorld()
// A curtain 12 particles across and 8 down, hanging from its top row.
val curtain = world.cloth(left = 0f, top = 0f, columns = 12, rows = 8, spacing = 6f)
assertPrints(curtain, "Cloth(12x8)")
assertPrints(world.particles.inverseMassOf(curtain.particleAt(5, 0)), "0.0")
assertPrints(world.particles.inverseMassOf(curtain.particleAt(5, 7)) > 0f, "true")