}
static ShapeDef translateShape(Shape shape, double elasticity) {
if (shape instanceof Polygon) {
Polygon poly = (Polygon) shape;
PolygonDef def = new PolygonDef();
// TODO Set def.density for realistic mass;
def.restitution = (float) elasticity;
for (int i = 0; i < poly.npoints; i++) {
def.vertices.add(new Vec2(poly.xpoints[i], poly.ypoints[i]));
}