tx.moveTo(x, y);
        for (let i = 1; i < face.length; i++) {
            const [x, y] = project(...vertices[face[i]]);
            ctx.lineTo(x, y);
        }
        ctx.closePath();
        ctx.fill();
        ctx.stroke();
    }

    requestAnimationFrame(draw);
}

function createControls() {
    const paramControls = document.getElementById('paramControls');
    paramControls.innerHTML = '';
    const params = polyhedrons[currentPolyhedronType].params;
    Object.entries(params).forEach(([key, param