diff --git a/js/models/dmaBeam.js b/js/models/dmaBeam.js index 1e2bdd17d3b513684da10c0a59b6e23cd254d7c8..94d9fdd7f5e6988dedd035fa919e5186cf15c99a 100644 --- a/js/models/dmaBeam.js +++ b/js/models/dmaBeam.js @@ -3,12 +3,12 @@ */ -//a single beam +//a single beam, made from two nodes function Beam(node1, node2) { this.nodes = [node1, node2]; var self = this; - _.each(nodes, function(node){ + _.each(nodes, function(node){//give each node a reference to the new beam it is connected to node.addBeam(self); }); } diff --git a/js/models/dmaCell.js b/js/models/dmaCell.js index 9d70eac28ce7e403cdc1447014fd04dd96afd7b7..aae9878e104f7b9a85d6092b62e2e2967e26a9fa 100644 --- a/js/models/dmaCell.js +++ b/js/models/dmaCell.js @@ -1,3 +1,28 @@ /** * Created by aghassaei on 1/14/15. */ + + +//a Cell, a unit piece of the lattice + +function Cell(nodes, config) { + this.parts = this._createParts(nodes, config); +}; + +Cell.prototype._createParts = function(nodes, config){ + var parts = []; + for (var i=0;i<nodes.length;i++){ + parts.push(new Part(nodes[i], config[i])); + } + return parts; +}; + +Cell.prototype.render = function(scene){ +}; + + +Cell.prototype.translate = function(dx, dy, dz){ +}; + +Cell.prototype.rotate = function(rx, ry, rz){ +}; diff --git a/js/models/dmaPart.js b/js/models/dmaPart.js index 06523c0143d1ecae78ae0cfc6739ab3035283a81..23c7c625cf49d7f381c872203b31ffee8271e9d3 100644 --- a/js/models/dmaPart.js +++ b/js/models/dmaPart.js @@ -3,9 +3,11 @@ */ +//a part, element with a single material, handled by assembler + function Part(nodes, config) {//list of nodes, config tells how nodes are connected - self.nodes = nodes; - self.beams = self._createBeams(nodes, config); + this.nodes = nodes; + this.beams = this._createBeams(nodes, config); }; Part.prototype._createBeams = function(nodes, config){ @@ -25,3 +27,12 @@ Part.prototype.translate = function(dx, dy, dz){ Part.prototype.rotate = function(rx, ry, rz){ }; + + + + +//matt's part +function PartTriangle(nodes){ +} + +PartTriangle.prototype = new Part(nodes, [[0,1],[1,2],[2,0]]); \ No newline at end of file