Commit 7f664000 authored by amandaghassaei's avatar amandaghassaei
Browse files

cleaning up

parent 4dd896c8
......@@ -97,11 +97,6 @@ a.btn:visited, a.btn:focus{
outline: grey;
border:none;
}
#controls .radio{
height: 42px;
display: inline-block;
width: 100%;
}
input.form-control {
width: 90px;
......@@ -239,13 +234,6 @@ span.modal-close{
transition-duration: 0s;
}
#controls .checkbox input.custom-radio[type="radio"]:checked + .icons, #controls .radio input.custom-radio[type="radio"]:checked + .icons {
margin-top:9px;
}
#controls .radio .icons {
margin-top:9px;
}
.sliderInput>.flat-slider{
width: 132px;
}
......
......@@ -383,9 +383,20 @@
<div id="threeContainer"></div>
<canvas id="gpuMathCanvas"></canvas>
<div id="controls">
<b>Simulation:</b><br/>
<div class="indent">
<label class="radio">
<input name="simType" value="dynamic" data-toggle="radio" class="custom-radio" type="radio"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>
Dynamic Simulation
</label>
<label class="radio">
<input name="simType" value="static" data-toggle="radio" class="custom-radio" type="radio"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>
Static Simulation (not finished yet)
</label>
</div><br/>
<b>Fold Settings:</b><br/><br/>
<div class="sliderInput" id="creasePercent">
<span class="label-slider">Crease Percent : </span><div class="flat-slider ui-slider ui-corner-all ui-slider-horizontal ui-widget ui-widget-content"></div>
<span class="label-slider">Fold Percent : </span><div class="flat-slider ui-slider ui-corner-all ui-slider-horizontal ui-widget ui-widget-content"></div>
<input value="" placeholder="" class="form-control" type="text">
</div>
<br/><br/><br/>
......@@ -440,9 +451,9 @@
<div class="modal-content">
<div class="modal-body">
<p><b>Origami Simulator</b><br/><br/>
<a href="http://www2.eng.cam.ac.uk/~sdg/preprint/5OSME.pdf">Origami Folding; A Structural Engineering Approach</a><br/>
<a href="http://origami.c.u-tokyo.ac.jp/~tachi/cg/SimulationOfRigidOrigami_tachi_4OSME.pdf">Rigid Origami Simulator</a><br/>
<a href="https://github.com/mapbox/earcut">Earcut Library</a><br/>
<a target="_blank" href="http://www2.eng.cam.ac.uk/~sdg/preprint/5OSME.pdf">Origami Folding; A Structural Engineering Approach</a><br/>
<a target="_blank" href="http://origami.c.u-tokyo.ac.jp/~tachi/cg/SimulationOfRigidOrigami_tachi_4OSME.pdf">Rigid Origami Simulator</a><br/>
<a target="_blank" href="https://github.com/mapbox/earcut">Earcut Library</a><br/>
<br/><br/>
Built by <a href="http://www.amandaghassaei.com/" target="_blank">Amanda Ghassaei</a> as a final project for <a href="http://courses.csail.mit.edu/6.849/spring17/" target="_blank">Geometric Folding Algorithms</a>.
......
......@@ -52,6 +52,10 @@ function initControls(globals){
globals.schematicVisible = val;
});
setRadio("simType", globals.simType, function(val){
globals.simType = val;
});
setSliderInput("#axialStiffness", globals.axialStiffness, 1000, 4000, 1, function(val){
globals.axialStiffness = val;
globals.materialHasChanged = true;
......
......@@ -12,7 +12,7 @@ function initGlobals(){
//view
colorMode: "color",
color1: "ec008b",
color2: "ffffff",
color2: "dddddd",
edgesVisible: true,
//flags
......
......@@ -30,7 +30,6 @@ function initModel(globals){
var geometry = new THREE.Geometry();
geometry.dynamic = true;
var object3D = new THREE.Mesh(geometry, material);
globals.threeView.sceneAdd(object3D);
function getGeometry(){
return geometry;
......@@ -139,6 +138,7 @@ function initModel(globals){
}
globals.threeView.sceneClearModel();
var _allNodeObject3Ds = [];
_.each(_nodes, function(node){
var obj3D = node.getObject3D();
......@@ -193,6 +193,8 @@ function initModel(globals){
geometry.computeBoundingBox();
geometry.computeBoundingSphere();
globals.threeView.sceneAddModel(object3D);
globals.shouldSyncWithModel = true;
inited = true;
// globals.staticSolver.syncNodesAndEdges();
......
......@@ -4,11 +4,6 @@
function initPattern(globals){
var object3D = new THREE.Object3D();
globals.threeView.sceneAddPattern(object3D);
// var intersections = new THREE.Object3D();
// object3D.add(intersections);
var verticesRaw = [];//list of vertex3's
//refs to vertex indices
var mountainsRaw = [];
......@@ -162,7 +157,6 @@ function initPattern(globals){
var allEdges = outlines.concat(mountains).concat(valleys).concat(cuts);
var faces = triangulatePolys(findPolygons(allEdges), allEdges);
drawPattern(faces);
globals.threeView.render();
var allCreaseParams = getFacesAndVerticesForEdges(faces, allEdges);
......@@ -613,39 +607,6 @@ function initPattern(globals){
};
}
function drawPattern(faces){
// console.log("draw pattern");
// object3D.children = [];
//
// var geo = new THREE.Geometry();
// geo.vertices = vertices;
// geo.faces = faces;
// geo.computeVertexNormals();
// var mesh = new THREE.Mesh(geo, new THREE.MeshBasicMaterial({side:THREE.DoubleSide, color:0xffffff}));
// // object3D.add(mesh);
// var mesh = new THREE.Mesh(geo, new THREE.MeshBasicMaterial({color:0x000000, wireframe:true}));
// object3D.add(mesh);
// object3D.add(new THREE.LineSegments(makeGeoFromSVGSegments(outlines),
// new THREE.LineBasicMaterial({color: 0x000000, linewidth: 4})));
// object3D.add(new THREE.LineSegments(makeGeoFromSVGSegments(mountains),
// new THREE.LineBasicMaterial({color: 0xff0000, linewidth: 4})));
// object3D.add(new THREE.LineSegments(makeGeoFromSVGSegments(valleys),
// new THREE.LineBasicMaterial({color: 0x0000ff, linewidth: 4})));
// var bounds = new THREE.Box3().setFromObject(object3D);
// var avg = (bounds.min.add(bounds.max)).multiplyScalar(0.5);
// object3D.position.set(-avg.x, 0, -avg.z);
}
function makeGeoFromSVGSegments(segments){
var geometry = new THREE.Geometry;
for (var i=0;i<segments.length;i++){
geometry.vertices.push(vertices[segments[i][0]].clone());
geometry.vertices.push(vertices[segments[i][1]].clone());
}
return geometry;
}
return {
loadSVG: loadSVG
}
......
......@@ -15,5 +15,5 @@ function saveSTL(){
var stlBin = geometryToSTLBin(data);
if (!stlBin) return;
var blob = new Blob([stlBin], {type: 'application/octet-binary'});
saveAs(blob, "shell.stl");
saveAs(blob, "Origami : " + parseInt(globals.creasePercent*100) + "PercentFolded.stl");
}
\ No newline at end of file
......@@ -9,7 +9,7 @@ function initStaticSolver(){
var geometry = new THREE.Geometry();
geometry.dynamic = true;
var object3D = new THREE.Mesh(geometry, material);
globals.threeView.sceneAdd(object3D);
// globals.threeView.sceneAdd(object3D);
var nodes;
......
......@@ -5,8 +5,6 @@
function initThreeView(globals) {
var scene = new THREE.Scene();
var wrapper = new THREE.Object3D();
var patternWrapper = new THREE.Object3D();
var modelWrapper = new THREE.Object3D();
var camera = new THREE.OrthographicCamera(window.innerWidth / -2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / -2, -10000, 10000);//-40, 40);
var renderer = new THREE.WebGLRenderer({antialias: true});
......@@ -24,9 +22,6 @@ function initThreeView(globals) {
container.append(renderer.domElement);
scene.background = new THREE.Color(0xffffff);//new THREE.Color(0xe6e6e6);
scene.add(wrapper);
scene.add(patternWrapper);
patternWrapper.visible = false;
scene.add(modelWrapper);
var directionalLight1 = new THREE.DirectionalLight(0xffffff, 0.8);
directionalLight1.position.set(0, 100, 0);
......@@ -126,16 +121,8 @@ function initThreeView(globals) {
modelWrapper.add(object);
}
function sceneClearModel(object){
modelWrapper.children =[];
}
function sceneAdd(object){
wrapper.add(object);
}
function sceneRemove(object){
wrapper.remove(object);
function sceneClearModel(){
modelWrapper.children = [];
}
function onWindowResize() {
......@@ -156,30 +143,15 @@ function initThreeView(globals) {
controls.enableRotate = state;
}
function centerModel(position){
// modelWrapper.position.set(position.x, 0, position.z);
}
function getModelOffset(){
return modelWrapper.position.clone();
}
return {
sceneAddPattern: sceneAddPattern,
sceneRemovePattern: sceneRemovePattern,
sceneClearPattern: sceneClearPattern,
sceneAddModel: sceneAddModel,
sceneClearModel: sceneClearModel,
centerModel: centerModel,
sceneAdd: sceneAdd,
sceneRemove: sceneRemove,
render: render,
onWindowResize: onWindowResize,
startAnimation: startAnimation,
pauseAnimation: pauseAnimation,
enableControls: enableControls,
getModelOffset: getModelOffset,
scene: scene,
camera: camera
}
......
Markdown is supported
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