From 69130290d47f90951742fa9c87ba2de17eb3233c Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Wed, 14 Jan 2015 17:10:44 -0500
Subject: [PATCH] filling out physical elements

---
 js/models/dmaBeam.js |  4 ++--
 js/models/dmaCell.js | 25 +++++++++++++++++++++++++
 js/models/dmaPart.js | 15 +++++++++++++--
 3 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/js/models/dmaBeam.js b/js/models/dmaBeam.js
index 1e2bdd17..94d9fdd7 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 9d70eac2..aae9878e 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 06523c01..23c7c625 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
-- 
GitLab