Is there a way to render this shape?
Unfortunately, my attempt at creating a custom mesh failed and resulted in an error.
I found some old THREE.js code that partially solves the problem, but it relies on the deprecated THREE.Face4() method. After consulting StackOverflow, I attempted to use 2 THREE.Face3() as a workaround, which also didn't work. Here is the code snippet:
// Function to draw a square using '2 Face3' to emulate 'Face4', credits to @Kevin Miller and @Jonathan.
function drawSquare(x1, y1, x2, y2) {
var square = new THREE.Geometry();
// Define four points for the square
square.vertices.push( new THREE.Vector3( x1,y2,0) );
square.vertices.push( new THREE.Vector3( x1,y1,0) );
square.vertices.push( new THREE.Vector3( x2,y1,0) );
square.vertices.push( new THREE.Vector3( x2,y2,0) );
// Add two triangles to complete the square
square.faces.push( new THREE.Face3( 0,1,2) );
square.faces.push( new THREE.Face3( 0,3,2) );
return square;
};
// Vertex coordinates of a rhombic dodecahedron obtained from sacred-geometry.es
var vertices = [ /* vertex coordinates here */ ];
// Faces of the rhombic dodecahedron created by drawing squares between specific vertices
var faces = [ /* face calculations here */ ];
// Create the mesh for the rhombic dodecahedron
var rhombic_dodecahedron_geo = new THREE.Geometry();
for(c=0; c<vertices.length; c++) { rhombic_dodecahedron_geo.vertices.push( vertices[c] ) };
for(d=0; d<faces.length; d++) { rhombic_dodecahedron_geo.faces.push( faces[d] ) };
var rhombic_dodecahedron_mat = new THREE.MeshBasicMaterial( {color: 0x4B32AF, wireframe: false} );
var rhombic_dodecahedron = new THREE.Mesh(rhombic_dodecahedron_geo, rhombic_dodecahedron_mat);
scene.add(rhombic_dodecahedron);
If you notice any errors or have suggestions, I would greatly appreciate your help in resolving this frustrating issue. Thank you.