diff --git a/js/menus/AnimationMenuView.js b/js/menus/AnimationMenuView.js index fb22f7948f03df0f5f8bb389ea85335786fefa83..362f06af3264b2afd5c6065f213d28f318fb3c85 100644 --- a/js/menus/AnimationMenuView.js +++ b/js/menus/AnimationMenuView.js @@ -26,19 +26,21 @@ AnimationMenuView = Backbone.View.extend({ render: function(){ if (this.appState.get("currentTab") != "animate") return; -// this.$el.html(this.template(this.model.attributes)); + this.$el.html(this.template(this.model.attributes)); }, template: _.template('\ - Scene: \ - <div class="btn-group">\ - <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allScenes[currentScene] %><span class="caret"></span></button>\ - <ul role="menu" class="dropdown-menu">\ - <% _.each(_.keys(allScenes), function(key){ %>\ - <li><a class="sceneType" data-type="<%= key %>" href="#"><%= allScenes[key] %></a></li>\ - <% }); %>\ - </ul>\ - </div><br/><br/>\ + animation settings\ ') -}); \ No newline at end of file +}); + +// Scene: \ +// <div class="btn-group">\ +// <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allScenes[currentScene] %><span class="caret"></span></button>\ +// <ul role="menu" class="dropdown-menu">\ +// <% _.each(_.keys(allScenes), function(key){ %>\ +// <li><a class="sceneType" data-type="<%= key %>" href="#"><%= allScenes[key] %></a></li>\ +// <% }); %>\ +// </ul>\ +// </div><br/><br/>\ diff --git a/js/menus/AssemblerMenuView.js b/js/menus/AssemblerMenuView.js new file mode 100644 index 0000000000000000000000000000000000000000..aa1a23aaed21059eb542026f4a6981ae0de09c14 --- /dev/null +++ b/js/menus/AssemblerMenuView.js @@ -0,0 +1,31 @@ +/** + * Created by aghassaei on 2/25/15. + */ + + +AssemblerMenuView = Backbone.View.extend({ + + el: "#menuContent", + + events: { + }, + + initialize: function(options){ + + _.bindAll(this, "render"); + }, + + render: function(){ + if (this.model.get("currentTab") != "assembler") return; + this.$el.html(this.template()); + }, + + template: _.template("\ + <a href='https://www.youtube.com/watch?v=1Cv7qaz63nQ'>Kiva simulation</a><br/><br/>\ + <a href='http://fab.cba.mit.edu/classes/865.15/people/will.langford/2_replicating/index.html'>will's demo</a><br/><br/>\ + <a href='http://www.eecs.harvard.edu/ssr/papers/iros11wksp-werfel.pdf'>asynchronous, multi-agent assembly algorithms</a> (doesn't necessarily have to be swarm-based)\ + <a href='https://www.youtube.com/watch?v=XNoNpjYQN4s'>video</a>\ + <br/><br/>\ + ") + +}); \ No newline at end of file diff --git a/js/menus/ImportMenuView.js b/js/menus/ImportMenuView.js index e8a6f025d4bccd1e8e25c2d077ecb2e2b4eb928f..22936ba6c094e20514d383c4e3ba0f019dd9520c 100644 --- a/js/menus/ImportMenuView.js +++ b/js/menus/ImportMenuView.js @@ -146,8 +146,9 @@ ImportMenuView = Backbone.View.extend({ <!--<li><a class="selectMesh fillGeo" data-file="Airbus_A300-600.stl" href="#">Plane</a></li>-->\ <li><a id="selectWall" href="#">Wall</a></li>\ <li><a class="selectMesh cutTerrain" data-file="river.stl" href="#">Landscape 1</a></li>\ - \<li><a class="selectMesh cutTerrain" data-file="terrain.stl" href="#">Landscape 2</a></li>\ + <li><a class="selectMesh cutTerrain" data-file="terrain.stl" href="#">Landscape 2</a></li>\ </ul>\ + <br/><br/> todo: fill geometry - move/rotate/scale mesh\ </div><!-- /btn-group -->') }); \ No newline at end of file diff --git a/js/menus/LatticeMenuView.js b/js/menus/LatticeMenuView.js index 28ad0444d27142298b4786aaac229fd1223c6223..8c1dc4480e46525d2d7eac26f2e4997cfa8c4869 100644 --- a/js/menus/LatticeMenuView.js +++ b/js/menus/LatticeMenuView.js @@ -23,8 +23,15 @@ LatticeMenuView = Backbone.View.extend({ this.lattice = options.lattice; _.bindAll(this, "render"); - this.listenTo(this.model, "change", this.render); - this.listenTo(this.lattice, "change", this.render) + var self = this; + this.listenTo(this.model, "change", function(){ + var change = false; + _.each(_.keys(self.model.changedAttributes()), function(attribute){ + if (attribute != "currentNav" && attribute != "currentTab") change = true; + }); + if (change) this.render(); + }); + this.listenTo(this.lattice, "change", this.render()); }, _clearCells: function(e){ @@ -135,6 +142,10 @@ LatticeMenuView = Backbone.View.extend({ <input type="checkbox" <% if (shouldPreserveCells) { %> checked="checked" <% } %> value="" id="preserveCells" data-toggle="checkbox" class="custom-checkbox"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>\ Preserve cells on lattice change\ </label><br/><br/>\ + <label class="checkbox">\ + <input type="checkbox" value="" id="showInverse" data-toggle="checkbox" class="custom-checkbox"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>\ + Show Inverse Geometry\ + </label><br/><br/>\ Scale: <input id="scaleSlider" data-slider-id="ex1Slider" type="text" data-slider-min="1" data-slider-max="100" data-slider-step="0.1" data-slider-value="<%= scale %>"/>\ <br/><input id="latticeScale" value="<%= scale %>" placeholder="enter scale" class="form-control" type="text"><br/>\ Num Cells: <%= numCells %><br/>\ diff --git a/js/menus/MaterialMenuView.js b/js/menus/MaterialMenuView.js new file mode 100644 index 0000000000000000000000000000000000000000..67326973cd1c96bc576bb004859764d9f53ddeaf --- /dev/null +++ b/js/menus/MaterialMenuView.js @@ -0,0 +1,28 @@ +/** + * Created by aghassaei on 2/25/15. + */ + +MaterialMenuView = Backbone.View.extend({ + + el: "#menuContent", + + events: { + }, + + initialize: function(options){ + + _.bindAll(this, "render"); + }, + + render: function(){ + if (this.model.get("currentTab") != "material") return; + this.$el.html(this.template()); + }, + + template: _.template('\ + create materials and assign them to parts in the model\ + <br/><br/>\ + stiffness, elasticity\ + ') + +}); \ No newline at end of file diff --git a/js/menus/MenuWrapperView.js b/js/menus/MenuWrapperView.js index 64e5cd323108e0334c949cefbb437a160310ec30..113f46e759d123bc2c3451faf80609265c3d90b2 100644 --- a/js/menus/MenuWrapperView.js +++ b/js/menus/MenuWrapperView.js @@ -21,7 +21,11 @@ MenuWrapper = Backbone.View.extend({ this.sketchMenu = new SketchMenuView({model:options.lattice, appState:this.model}); this.partMenu = new PartMenuView({model:this.model, lattice:options.lattice}); this.scriptMenu = new ScriptMenuView({model:this.model}); -// this.animationMenu = new AnimationMenuView({model:options.lattice.get("basePlane"), appState:this.model}); + this.physicsMenu = new PhysicsMenuView({model:this.model}); + this.materialMenu = new MaterialMenuView({model:this.model}); + this.optimizeMenu = new OptimizationMenuView({model:this.model}); + this.assemblerMenu = new AssemblerMenuView({model:this.model}); + this.animationMenu = new AnimationMenuView({model:options.lattice.get("basePlane"), appState:this.model}); //data names and titles this.designMenuTabs = {lattice:"Lattice", import:"Import", sketch:"Sketch", part:"Part", script:"Script"}; @@ -64,6 +68,14 @@ MenuWrapper = Backbone.View.extend({ this.partMenu.render(); } else if (tabName == "script"){ this.scriptMenu.render(); + } else if (tabName == "physics"){ + this.physicsMenu.render(); + } else if (tabName == "material"){ + this.materialMenu.render(); + } else if (tabName == "optimize"){ + this.optimizeMenu.render(); + } else if (tabName == "assembler"){ + this.assemblerMenu.render(); } else if (tabName == "animate"){ this.animationMenu.render(); } else { diff --git a/js/menus/OptimizationMenuView.js b/js/menus/OptimizationMenuView.js new file mode 100644 index 0000000000000000000000000000000000000000..de4100d16be4dbf54fd052deaa177ea0fe2de757 --- /dev/null +++ b/js/menus/OptimizationMenuView.js @@ -0,0 +1,27 @@ +/** + * Created by aghassaei on 2/25/15. + */ + +OptimizationMenuView = Backbone.View.extend({ + + el: "#menuContent", + + events: { + }, + + initialize: function(options){ + + _.bindAll(this, "render"); + }, + + render: function(){ + if (this.model.get("currentTab") != "optimize") return; + this.$el.html(this.template()); + }, + + template: _.template('\ + input stiffness requirements of structure\ + <br/><br/>\ + ') + +}); \ No newline at end of file diff --git a/js/menus/PartMenuView.js b/js/menus/PartMenuView.js index e266c67183759e0d9a3578b43bd6b2e81b396d7f..0f7c1339ddea95e8567867458178d5c444b01c6d 100644 --- a/js/menus/PartMenuView.js +++ b/js/menus/PartMenuView.js @@ -45,6 +45,8 @@ PartMenuView = Backbone.View.extend({ </ul>\ </div><br/><br/>\ Column Separation: <input id="columnSepSlider" data-slider-id="ex1Slider" type="text" data-slider-min="0" data-slider-max="35" data-slider-step="0.1" data-slider-value="<%= columnSeparation*100 %>"/>\ + <br/><br/>\ + todo: generic beam part type, part types for new lattice configurations\ ') }); \ No newline at end of file diff --git a/js/menus/PhysicsMenuView.js b/js/menus/PhysicsMenuView.js new file mode 100644 index 0000000000000000000000000000000000000000..d02ce409509c198893c328f5c40126263e70ec14 --- /dev/null +++ b/js/menus/PhysicsMenuView.js @@ -0,0 +1,30 @@ +/** + * Created by aghassaei on 2/25/15. + */ + +PhysicsMenuView = Backbone.View.extend({ + + el: "#menuContent", + + events: { + }, + + initialize: function(options){ + + _.bindAll(this, "render"); + }, + + render: function(){ + if (this.model.get("currentTab") != "physics") return; + this.$el.html(this.template()); + }, + + template: _.template('\ + world physics: gravity, global forces\ + <br/><br/>\ + part coneection stiffness\ + <br/><br/>\ + ground/fixed/boundary conditions selection\ + ') + +}); \ No newline at end of file diff --git a/js/menus/SketchMenuView.js b/js/menus/SketchMenuView.js index 8349d5421c928b6933cc6eef9f98843473d08eb0..0b69b789e1877a356ad0575b697ab511f6622b93 100644 --- a/js/menus/SketchMenuView.js +++ b/js/menus/SketchMenuView.js @@ -36,6 +36,8 @@ SketchMenuView = Backbone.View.extend({ template: _.template('\ Sketch Plane Height: <input id="zHeightSlider" data-slider-id="ex1Slider" type="text" data-slider-min="0" data-slider-max="20" data-slider-step="1" data-slider-value="<%= zIndex %>"/>\ + <br/><br/>\ + todo: Sketch and extrude/cut commands\ ') }); \ No newline at end of file diff --git a/js/models/Lattice.js b/js/models/Lattice.js index 3e806f73e7815cb7d3ae124676d052fef93a1743..efdb29e91b6222bc565391cafa76926cd123aa97 100644 --- a/js/models/Lattice.js +++ b/js/models/Lattice.js @@ -151,7 +151,8 @@ Lattice = Backbone.Model.extend({ } if (!firstCell) continue;//nothing in col - var origin = firstCell._calcPosition(0, this._add({x:x,y:y,z:z}, cellsMin)); + var origin = this._positionForIndex(firstCell.indices); +// firstCell._calcPosition(0, this._add({x:x,y:y,z:z}, cellsMin)); zHeight = this._findIntersectionsInWindow(xScale/2, yScale/2, origin, allVertexPos) || zHeight; zHeight = Math.floor(zHeight/zScale); diff --git a/main.html b/main.html index 932f37b76c6a99b13266170b836b3d25b19c1f31..b994f8a812788f5b03905c8cbc5f4ca3b86b9773 100644 --- a/main.html +++ b/main.html @@ -66,8 +66,12 @@ <script src="js/menus/PartMenuView.js"></script> <script src="js/menus/SketchMenuView.js"></script> <script src="js/menus/ScriptMenuView.js"></script> - <script src="js/menus/AnimationMenuView.js"></script> <script src="js/menus/exportMenu.js"></script> + <script src="js/menus/PhysicsMenuView.js"></script> + <script src="js/menus/MaterialMenuView.js"></script> + <script src="js/menus/OptimizationMenuView.js"></script> + <script src="js/menus/AssemblerMenuView.js"></script> + <script src="js/menus/AnimationMenuView.js"></script> <script src="js/threeViews/Highlighter.js"></script> <script src="js/threeViews/ThreeView.js"></script>