Shape
What a rigid body is made of: a convex shape, in the body's own units, around the body's origin. Make one with circle, box, polygon or capsule; a body made of several is a compound body, such as a hammer of two boxes.
Inside, every shape is a convex core, one point for a circle, two for a capsule, three or more for a polygon, grown by a radius: a circle is a point grown by its radius, a capsule a segment, a polygon has a radius of 0. One way of describing all of them means one set of collision code.
A polygon's points go clockwise on screen (y grows down), and each edge i, from point i to the next, has a unit normal pointing out. A shape never changes once made, so any number of bodies can share one.
toString gives its kind and size, for example Shape(POLYGON, vertices=4, radius=0.0).
Samples
val ball = Shape.circle(radius = 8f)
val crate = Shape.box(width = 20f, height = 20f)
val pill = Shape.capsule(length = 30f, radius = 5f)
val wedge = Shape.polygon(listOf(Vec2(0f, 0f), Vec2(30f, 0f), Vec2(0f, -20f)))
assertPrints(crate, "Shape(POLYGON, vertices=4, radius=0.0)")
assertPrints(ball.contains(0f, 7f), "true")
assertPrints(pill.vertexCount, "2")
assertPrints(wedge.area, "300.0")