Skip to content
Snippets Groups Projects
Commit ffa57146 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

flat shading on octa cells

parent 961f44b9
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,27 @@ ...@@ -6,7 +6,27 @@
define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'],
function(_, THREE, three, lattice, appState, DMACell){ function(_, THREE, three, lattice, appState, DMACell){
var unitGeo = new THREE.OctahedronGeometry(1/Math.sqrt(2)); var unitGeo = new THREE.Geometry();
unitGeo.vertices = [
new THREE.Vector3(0.7071067811865475, 0, 0),
new THREE.Vector3(-0.7071067811865475, 0, 0),
new THREE.Vector3(0, 0.7071067811865475, 0),
new THREE.Vector3(0, -0.7071067811865475, 0),
new THREE.Vector3(0, 0, 0.7071067811865475),
new THREE.Vector3(0, 0, -0.7071067811865475)
];
unitGeo.faces = [
new THREE.Face3(2, 4, 0),
new THREE.Face3(4, 3, 0),
new THREE.Face3(3, 5, 0),
new THREE.Face3(5, 2, 0),
new THREE.Face3(2, 5, 1),
new THREE.Face3(5, 3, 1),
new THREE.Face3(3, 4, 1),
new THREE.Face3(4, 2, 1)
];
unitGeo.computeFaceNormals();
unitGeo.applyMatrix(new THREE.Matrix4().makeRotationZ(-3*Math.PI/12)); unitGeo.applyMatrix(new THREE.Matrix4().makeRotationZ(-3*Math.PI/12));
unitGeo.applyMatrix(new THREE.Matrix4().makeRotationX(Math.asin(2/Math.sqrt(2)/Math.sqrt(3)))); unitGeo.applyMatrix(new THREE.Matrix4().makeRotationX(Math.asin(2/Math.sqrt(2)/Math.sqrt(3))));
......
...@@ -6,7 +6,27 @@ ...@@ -6,7 +6,27 @@
define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'],
function(_, THREE, three, lattice, appState, DMACell){ function(_, THREE, three, lattice, appState, DMACell){
var unitGeo = new THREE.OctahedronGeometry(1/Math.sqrt(2)); var unitGeo = new THREE.Geometry();
unitGeo.vertices = [
new THREE.Vector3(0.7071067811865475, 0, 0),
new THREE.Vector3(-0.7071067811865475, 0, 0),
new THREE.Vector3(0, 0.7071067811865475, 0),
new THREE.Vector3(0, -0.7071067811865475, 0),
new THREE.Vector3(0, 0, 0.7071067811865475),
new THREE.Vector3(0, 0, -0.7071067811865475)
];
unitGeo.faces = [
new THREE.Face3(2, 4, 0),
new THREE.Face3(4, 3, 0),
new THREE.Face3(3, 5, 0),
new THREE.Face3(5, 2, 0),
new THREE.Face3(2, 5, 1),
new THREE.Face3(5, 3, 1),
new THREE.Face3(3, 4, 1),
new THREE.Face3(4, 2, 1)
];
unitGeo.computeFaceNormals();
unitGeo.applyMatrix(new THREE.Matrix4().makeRotationZ(Math.PI/4)); unitGeo.applyMatrix(new THREE.Matrix4().makeRotationZ(Math.PI/4));
function OctaRotEdgeCell(json, superCell){ function OctaRotEdgeCell(json, superCell){
......
...@@ -6,7 +6,27 @@ ...@@ -6,7 +6,27 @@
define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'],
function(_, THREE, three, lattice, appState, DMACell){ function(_, THREE, three, lattice, appState, DMACell){
var unitGeo = new THREE.OctahedronGeometry(1/Math.sqrt(2)); var unitGeo = new THREE.Geometry();
unitGeo.vertices = [
new THREE.Vector3(0.7071067811865475, 0, 0),
new THREE.Vector3(-0.7071067811865475, 0, 0),
new THREE.Vector3(0, 0.7071067811865475, 0),
new THREE.Vector3(0, -0.7071067811865475, 0),
new THREE.Vector3(0, 0, 0.7071067811865475),
new THREE.Vector3(0, 0, -0.7071067811865475)
];
unitGeo.faces = [
new THREE.Face3(2, 4, 0),
new THREE.Face3(4, 3, 0),
new THREE.Face3(3, 5, 0),
new THREE.Face3(5, 2, 0),
new THREE.Face3(2, 5, 1),
new THREE.Face3(5, 3, 1),
new THREE.Face3(3, 4, 1),
new THREE.Face3(4, 2, 1)
];
unitGeo.computeFaceNormals();
function OctaVertexCell(json, superCell){ function OctaVertexCell(json, superCell){
DMACell.call(this, json, superCell); DMACell.call(this, json, superCell);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment