diff --git a/js/cells/TetraStackedCell.js b/js/cells/TetraStackedCell.js index 2e477b290d4011b7c79a6a8420054d669849b567..0e3e96e45c4ff9e531694e0aeaef4bdeb7bd68c3 100644 --- a/js/cells/TetraStackedCell.js +++ b/js/cells/TetraStackedCell.js @@ -6,7 +6,20 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], function(_, THREE, three, lattice, appState, DMACell){ - var unitGeo = new THREE.TetrahedronGeometry(Math.sqrt(3/8)); + var unitGeo = new THREE.Geometry(); + unitGeo.vertices = [ + new THREE.Vector3(0.3535533905932738, 0.3535533905932738, 0.3535533905932738), + new THREE.Vector3(-0.3535533905932738, -0.3535533905932738, 0.3535533905932738), + new THREE.Vector3(-0.3535533905932738, 0.3535533905932738, -0.3535533905932738), + new THREE.Vector3(0.3535533905932738, -0.3535533905932738, -0.3535533905932738) + ]; + unitGeo.faces = [ + new THREE.Face3(1, 0, 2), + new THREE.Face3(3, 2, 0), + new THREE.Face3(3, 0, 1), + new THREE.Face3(3, 1, 2) + ]; + unitGeo.computeFaceNormals(); unitGeo.applyMatrix(new THREE.Matrix4().makeRotationZ(Math.PI/4)); unitGeo.applyMatrix(new THREE.Matrix4().makeRotationX((Math.PI-Math.atan(2*Math.sqrt(2)))/2)); unitGeo.applyMatrix(new THREE.Matrix4().makeTranslation(0,0,Math.sqrt(3/8)-2/Math.sqrt(6))); diff --git a/js/cells/TetraVertexCell.js b/js/cells/TetraVertexCell.js index 57bdda5ef00209ade5524d436b3f8b5d64eb79ae..f651c9e97f632a0d438e30a344c0ea4a268767f0 100644 --- a/js/cells/TetraVertexCell.js +++ b/js/cells/TetraVertexCell.js @@ -6,7 +6,20 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], function(_, THREE, three, lattice, appState, DMACell){ - var unitGeo = new THREE.TetrahedronGeometry(Math.sqrt(3/8)); + var unitGeo = new THREE.Geometry(); + unitGeo.vertices = [ + new THREE.Vector3(0.3535533905932738, 0.3535533905932738, 0.3535533905932738), + new THREE.Vector3(-0.3535533905932738, -0.3535533905932738, 0.3535533905932738), + new THREE.Vector3(-0.3535533905932738, 0.3535533905932738, -0.3535533905932738), + new THREE.Vector3(0.3535533905932738, -0.3535533905932738, -0.3535533905932738) + ]; + unitGeo.faces = [ + new THREE.Face3(1, 0, 2), + new THREE.Face3(3, 2, 0), + new THREE.Face3(3, 0, 1), + new THREE.Face3(3, 1, 2) + ]; + unitGeo.computeFaceNormals(); unitGeo.applyMatrix(new THREE.Matrix4().makeRotationZ(Math.PI/4)); unitGeo.applyMatrix(new THREE.Matrix4().makeRotationX((Math.PI-Math.atan(2*Math.sqrt(2)))/2)); unitGeo.applyMatrix(new THREE.Matrix4().makeTranslation(0,0,Math.sqrt(3/8)-2/Math.sqrt(6)));