     for (let i = 0; i <= segments; i++) {
                const phi = (i / segments) * Math.PI;
                for (let j = 0; j <= segments; j++) {
                    const theta = (j / segments) * 2 * Math.PI;
                    const x = Math.sin(phi) * Math.cos(theta);
                    const y = Math.cos(phi);
                    const z = Math.sin(phi) * Math.sin(theta);
                    vertices.push([x, y, z]);
                    if (i < segments && j < segments) {
                        