Commit 9145402a authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

hex cells

parent 706e4e63
/**
* 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 @@
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;
});
......@@ -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',
......
......@@ -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
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment