BALL IN CONCAVE SQUARE · 1024×1024 TORUS

Both bodies have mass 1. Elastic collisions conserve linear momentum, angular momentum, and kinetic energy exactly — no friction, no loss. When rotation is enabled the square's moment of inertia is computed for the hollow shape (outer 200×200, hole 100×100). The field wraps in X and Y.