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

hex cells

parent 706e4e63
No related branches found
No related tags found
No related merge requests found
/**
* Created by aghassaei on 8/17/15.
*/
define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'],
function(_, THREE, three, lattice, appState, DMACell){
var unitCellGeo = new THREE.CylinderGeometry(Math.sqrt(3)/2, Math.sqrt(3)/2, 1, 6);
unitCellGeo.applyMatrix(new THREE.Matrix4().makeRotationX(Math.PI/2));
function HexagonalCell(json, superCell){
DMACell.call(this, json, superCell);
}
HexagonalCell.prototype = Object.create(DMACell.prototype);
HexagonalCell.prototype._getGeometry = function(){
return unitCellGeo;
};
// HexagonalCell.prototype._buildWireframe = function(mesh){//abstract mesh representation of cell
// var wireframe = new THREE.BoxHelper(mesh);
// wireframe.material.color.set(0x000000);
// wireframe.matrixWorld = mesh.matrixWorld;
// wireframe.matrixAutoUpdate = true;
// return wireframe;
// };
return HexagonalCell;
});
\ No newline at end of file
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'threeModel'], define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'threeModel'],
function(_, Backbone, appState, globals, plist, THREE, three){ function(_, Backbone, appState, globals, plist, THREE, three){
var KelvinLattice = { var HexLattice = {
_initLatticeType: function(){ _initLatticeType: function(){
require(['hexBaseplane'], function(SquareBasePlane){ require(['hexBaseplane'], function(BasePlaneClass){
globals.basePlane = new SquareBasePlane(); globals.basePlane = new BasePlaneClass();
}); });
require([this.getHighlighterFile()], function(TruncatedCubeHighlighter){ require([this.getHighlighterFile()], function(HighlighterClass){
globals.highlighter = new TruncatedCubeHighlighter(); globals.highlighter = new HighlighterClass();
}); });
}, },
...@@ -31,7 +31,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre ...@@ -31,7 +31,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
xScale: function(cellSeparation){ xScale: function(cellSeparation){
if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy; if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").xy;
return 2*Math.sqrt(2)+2*cellSeparation; return 2*Math.sqrt(3)+2*cellSeparation;
}, },
yScale: function(cellSeparation){ yScale: function(cellSeparation){
...@@ -40,21 +40,21 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre ...@@ -40,21 +40,21 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
zScale: function(cellSeparation){ zScale: function(cellSeparation){
if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z; if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z;
return 2*Math.sqrt(2)+2*cellSeparation; return 1+2*cellSeparation;
}, },
getCellSubclassFile: function(){ getCellSubclassFile: function(){
return "kelvinCell"; return "hexCell";
}, },
_undo: function(){//remove all the mixins, this will help with debugging later _undo: function(){//remove all the mixins, this will help with debugging later
var self = this; var self = this;
_.each(_.keys(KelvinLattice), function(key){ _.each(_.keys(HexLattice), function(key){
self[key] = null; self[key] = null;
}); });
} }
}; };
return KelvinLattice; return HexLattice;
}); });
...@@ -85,6 +85,7 @@ require.config({ ...@@ -85,6 +85,7 @@ require.config({
superCell: 'cells/supercells/DMASuperCell', superCell: 'cells/supercells/DMASuperCell',
gikSuperCell: 'cells/supercells/GIKSuperCell', gikSuperCell: 'cells/supercells/GIKSuperCell',
compositeCell: "cells/supercells/CompositeCell", compositeCell: "cells/supercells/CompositeCell",
hexCell: 'cells/HexagonalCell',
//parts //parts
part: 'parts/DMAPart', part: 'parts/DMAPart',
......
...@@ -31,4 +31,5 @@ ...@@ -31,4 +31,5 @@
<li><a class="appState" data-property="cellMode" data-value="<%= key %>" href="#"><% if (cellMode == key) { %><span class="fui-check"></span><% } %><%= mode %></a></li> <li><a class="appState" data-property="cellMode" data-value="<%= key %>" href="#"><% if (cellMode == key) { %><span class="fui-check"></span><% } %><%= mode %></a></li>
<% }); %> <% }); %>
</ul> </ul>
</li> </li>
\ No newline at end of file <li><a class="" href="#">Keyboard Shortcuts</a></li>
\ No newline at end of file
...@@ -58,7 +58,7 @@ define(['three'], function(THREE){ ...@@ -58,7 +58,7 @@ define(['three'], function(THREE){
cube:"Cube", cube:"Cube",
truncatedCube:"Cuboctahedron", truncatedCube:"Cuboctahedron",
kelvin:"Kelvin", kelvin:"Kelvin",
// hex: "Hexagonal" hex: "Hexagonal"
}, },
allConnectionTypes: { allConnectionTypes: {
octa: {face:"Face", edgeRot:"Edge", vertex:"Vertex"},// freeformFace:"Freeform Face" edge:"Edge", (Rotated) octa: {face:"Face", edgeRot:"Edge", vertex:"Vertex"},// freeformFace:"Freeform Face" edge:"Edge", (Rotated)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment