Explaining Clusters
A cluster is a group of cubes of the same color that are touching face planes, not their corners, forming a solid geometric shape.
To Aid in Visualization
Imagine each Lego piece to be 1x1
units in size.
https://i.sstatic.net/z9qFm.png
For instance, let's consider a 2x2x2
mesh composed of 1x1x1
cubes:
var mesh = [
// First layer ( x, y, z )
new THREE.Vector3( 0, 0, 0 ),
new THREE.Vector3( 0, 0, 1 ),
new THREE.Vector3( 1, 0, 0 ),
new THREE.Vector3( 1, 0, 1 )
//Second layer ( x, y, z )
new THREE.Vector3( 0, 1, 0 ),
new THREE.Vector3( 0, 1, 1 ),
new THREE.Vector3( 1, 1, 0 ),
new THREE.Vector3( 1, 1, 1 )
];
https://i.sstatic.net/7CCrT.jpg
Each cube within the mesh is assigned a color:
//Indexes of mesh array sorted by color
var colors = {
red: [0, 1, 4, 6],
green: [2, 3, 5, 7]
}