diff --git a/js/cells/HexagonalCell.js b/js/cells/HexagonalCell.js new file mode 100644 index 0000000000000000000000000000000000000000..e3cd7d14fe4e1f286e51f7e5a450531ca5f45ca3 --- /dev/null +++ b/js/cells/HexagonalCell.js @@ -0,0 +1,30 @@ +/** + * 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 diff --git a/js/lattice/latticeSubclasses/HexagonalLattice.js b/js/lattice/latticeSubclasses/HexagonalLattice.js index bceb37d70127d372e9169d88f051e65c034e5a4e..24a6d36d578e9507b927290e316323999a2cf510 100644 --- a/js/lattice/latticeSubclasses/HexagonalLattice.js +++ b/js/lattice/latticeSubclasses/HexagonalLattice.js @@ -6,14 +6,14 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'threeModel'], function(_, Backbone, appState, globals, plist, THREE, three){ - var KelvinLattice = { + var HexLattice = { _initLatticeType: function(){ - require(['hexBaseplane'], function(SquareBasePlane){ - globals.basePlane = new SquareBasePlane(); + require(['hexBaseplane'], function(BasePlaneClass){ + globals.basePlane = new BasePlaneClass(); }); - require([this.getHighlighterFile()], function(TruncatedCubeHighlighter){ - globals.highlighter = new TruncatedCubeHighlighter(); + require([this.getHighlighterFile()], function(HighlighterClass){ + globals.highlighter = new HighlighterClass(); }); }, @@ -31,7 +31,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre xScale: function(cellSeparation){ 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){ @@ -40,21 +40,21 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre zScale: function(cellSeparation){ if (cellSeparation === undefined) cellSeparation = this.get("cellSeparation").z; - return 2*Math.sqrt(2)+2*cellSeparation; + return 1+2*cellSeparation; }, getCellSubclassFile: function(){ - return "kelvinCell"; + return "hexCell"; }, _undo: function(){//remove all the mixins, this will help with debugging later var self = this; - _.each(_.keys(KelvinLattice), function(key){ + _.each(_.keys(HexLattice), function(key){ self[key] = null; }); } }; - return KelvinLattice; + return HexLattice; }); diff --git a/js/main.js b/js/main.js index 2ea47c5e0e86742b96eb2f83aa7f931dddf51891..86e6dcc874e94e4250e5d34e58519cef13d76425 100644 --- a/js/main.js +++ b/js/main.js @@ -85,6 +85,7 @@ require.config({ superCell: 'cells/supercells/DMASuperCell', gikSuperCell: 'cells/supercells/GIKSuperCell', compositeCell: "cells/supercells/CompositeCell", + hexCell: 'cells/HexagonalCell', //parts part: 'parts/DMAPart', diff --git a/js/menus/templates/NavViewMenu.html b/js/menus/templates/NavViewMenu.html index a7446c5199989d17b1eb527ff6b2f42f8ada8933..d90881c8816195f212cbd79a25a84c01a2dbb82a 100644 --- a/js/menus/templates/NavViewMenu.html +++ b/js/menus/templates/NavViewMenu.html @@ -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> <% }); %> </ul> -</li> \ No newline at end of file +</li> +<li><a class="" href="#">Keyboard Shortcuts</a></li> \ No newline at end of file diff --git a/js/plists/PList.js b/js/plists/PList.js index 30f9a470c22ca1718eb0efa513cf3be4eec74576..b73fc996c5d7c53baa7f75f8d73e8370f255dc82 100644 --- a/js/plists/PList.js +++ b/js/plists/PList.js @@ -58,7 +58,7 @@ define(['three'], function(THREE){ cube:"Cube", truncatedCube:"Cuboctahedron", kelvin:"Kelvin", -// hex: "Hexagonal" + hex: "Hexagonal" }, allConnectionTypes: { octa: {face:"Face", edgeRot:"Edge", vertex:"Vertex"},// freeformFace:"Freeform Face" edge:"Edge", (Rotated)