vertices = {
return zValues.flatMap(z => {
const innerVertices = widthCoordinates.flatMap(
(x, i) => heightCoordinates.map(
(y, j) => {
const color = `rgb(${Math.round(100*(i+1)/widthCoordinates.length)}%, ${Math.round(100*(j+1)/heightCoordinates.length)}%, 100%)`
console.log(color);
return Sphere(x, y, z, 0.1, color);
}
)
);
const bottomSquares = widthCoordinates.map(x => Sphere(x, -(innerHeight / 2 + cardRadius), z, 0.1, '#32a852'));
const topSquares = widthCoordinates.map(x => Sphere(x, innerHeight / 2 + cardRadius, z, 0.1, '#32a852'));
const leftSquares = heightCoordinates.map(y => Sphere(-(innerWidth/2 + cardRadius), y, z, 0.1, '#eb4034'));
const rightSquares = heightCoordinates.map(y => Sphere(innerWidth/2 + cardRadius, y, z, 0.1, '#eb4034'));
const signs = [-1, 1];
const corners = signs.map(verticalSign => signs.map(horizontalSign => {
const vertices = [];
for (let i = 1; i < cornerSegments; ++i) {
const angle = i * Math.PI / (2 * cornerSegments);
const x = horizontalSign * (innerWidth / 2 + cardRadius * Math.cos(angle));
const y = verticalSign * (innerHeight / 2 + cardRadius * Math.sin(angle));
vertices.push(Sphere(x, y, z, 0.1, "#fcba03"))
}
return vertices;
})
);
return [
innerVertices,
bottomSquares,
topSquares,
leftSquares,
rightSquares,
corners
];
})
}