Commit 724d0239 authored by amandaghassaei's avatar amandaghassaei
Browse files

waterbomb

parent 71017022
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="3456px" height="6912px" viewBox="0 0 3456 6912" enable-background="new 0 0 3456 6912" xml:space="preserve">
<path fill="none" stroke="#0000FF" stroke-width="0.7087" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
M-2721.869,1193.053l-805.031,805.031 M-2721.869,1193.053l805.031,805.031 M-1111.807,1193.053l-805.031,805.031
M-1111.807,1193.053l805.032,805.031 M498.256,1193.053l-805.031,805.031 M498.256,1193.053l805.031,805.031 M2108.318,1193.053
l-805.031,805.031 M2108.318,1193.053l805.033,805.031 M3718.382,1193.053l-805.03,805.031 M3718.382,1193.053l805.031,805.031
M5328.443,1193.053l-805.03,805.031"/>
<path fill="none" stroke="#0000FF" stroke-width="0.7087" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
M-2721.869,2803.115l-805.031,805.031 M-2721.869,2803.115l805.031,805.031 M-1111.807,2803.115l-805.031,805.031
M-1111.807,2803.115l805.032,805.031 M498.256,2803.115l-805.031,805.031 M498.256,2803.115l805.031,805.031 M2108.318,2803.115
l-805.031,805.031 M2108.318,2803.115l805.033,805.031 M3718.382,2803.115l-805.03,805.031 M3718.382,2803.115l805.031,805.031
M5328.443,2803.115l-805.03,805.031"/>
<path fill="none" stroke="#0000FF" stroke-width="0.7087" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
M-3526.9,2803.115l805.031,805.031 M-1916.838,2803.115l-805.031,805.031 M-1916.838,2803.115l805.031,805.031 M-306.775,2803.115
l-805.032,805.031 M-306.775,2803.115l805.031,805.031 M1303.287,2803.115l-805.031,805.031 M1303.287,2803.115l805.031,805.031
M2913.352,2803.115l-805.033,805.031 M2913.352,2803.115l805.03,805.031 M4523.413,2803.115l-805.031,805.031 M4523.413,2803.115
l805.03,805.031"/>
<path fill="none" stroke="#0000FF" stroke-width="0.7087" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
M-2721.869,4413.178l-805.031,805.031 M-2721.869,4413.178l805.031,805.031 M-1111.807,4413.178l-805.031,805.031
M-1111.807,4413.178l805.032,805.031 M498.256,4413.178l-805.031,805.031 M498.256,4413.178l805.031,805.031 M2108.318,4413.178
l-805.031,805.031 M2108.318,4413.178l805.033,805.031 M3718.382,4413.178l-805.03,805.031 M3718.382,4413.178l805.031,805.031
M5328.443,4413.178l-805.03,805.031"/>
<path fill="none" stroke="#0000FF" stroke-width="0.7087" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
M-3526.9,1193.053l805.031,805.031 M-1916.838,1193.053l-805.031,805.031 M-1916.838,1193.053l805.031,805.031 M-306.775,1193.053
l-805.032,805.031 M-306.775,1193.053l805.031,805.031 M1303.287,1193.053l-805.031,805.031 M1303.287,1193.053l805.031,805.031
M2913.352,1193.053l-805.033,805.031 M2913.352,1193.053l805.03,805.031 M4523.413,1193.053l-805.031,805.031 M4523.413,1193.053
l805.03,805.031"/>
<path fill="none" stroke="#0000FF" stroke-width="0.7087" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
M-3124.385,1998.084L-3526.9,2400.6 M-3124.385,1998.084l402.516,402.516 M-1916.838,2400.6l-402.516,402.516 M-2721.869,2400.6
l402.515,402.516 M-1514.322,1998.084l402.515,402.516 M-1514.322,1998.084l-402.516,402.516 M-306.775,2400.6l-402.516,402.516
M-1111.807,2400.6l402.516,402.516 M95.74,1998.084L498.256,2400.6 M95.74,1998.084L-306.775,2400.6 M1303.287,2400.6
l-402.516,402.516 M498.256,2400.6l402.516,402.516 M1705.803,1998.084l402.516,402.516 M1705.803,1998.084L1303.287,2400.6
M2913.352,2400.6l-402.517,402.516 M2108.318,2400.6l402.517,402.516 M3315.866,1998.084l402.516,402.516 M3315.866,1998.084
L2913.352,2400.6 M4523.413,2400.6l-402.517,402.516 M3718.382,2400.6l402.515,402.516 M4925.928,1998.084L4523.413,2400.6
M4925.928,1998.084l402.516,402.516"/>
<path fill="none" stroke="#0000FF" stroke-width="0.7087" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
M-3526.9,2400.6l402.515,402.516 M-2721.869,2400.6l-402.516,402.516 M-2319.354,1998.084l402.516,402.516 M-2319.354,1998.084
l-402.515,402.516 M-1111.807,2400.6l-402.515,402.516 M-1916.838,2400.6l402.516,402.516 M-709.291,1998.084l402.516,402.516
M-709.291,1998.084l-402.516,402.516 M498.256,2400.6L95.74,2803.115 M-306.775,2400.6L95.74,2803.115 M900.771,1998.084
l402.516,402.516 M900.771,1998.084L498.256,2400.6 M2108.318,2400.6l-402.516,402.516 M1303.287,2400.6l402.516,402.516
M2510.835,1998.084l402.517,402.516 M2510.835,1998.084L2108.318,2400.6 M3718.382,2400.6l-402.516,402.516 M2913.352,2400.6
l402.515,402.516 M4120.896,1998.084l402.517,402.516 M4120.896,1998.084L3718.382,2400.6 M4523.413,2400.6l402.515,402.516
M5328.443,2400.6l-402.516,402.516"/>
<path fill="none" stroke="#0000FF" stroke-width="0.7087" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
M-3124.385,3608.146l-402.515,402.516 M-3124.385,3608.146l402.516,402.516 M-1916.838,4010.662l-402.516,402.516
M-2721.869,4010.662l402.515,402.516 M-1514.322,3608.146l402.515,402.516 M-1514.322,3608.146l-402.516,402.516
M-306.775,4010.662l-402.516,402.516 M-1111.807,4010.662l402.516,402.516 M95.74,3608.146l402.516,402.516 M95.74,3608.146
l-402.515,402.516 M1303.287,4010.662l-402.516,402.516 M498.256,4010.662l402.516,402.516 M1705.803,3608.146l402.516,402.516
M1705.803,3608.146l-402.516,402.516 M2913.352,4010.662l-402.517,402.516 M2108.318,4010.662l402.517,402.516 M3315.866,3608.146
l402.516,402.516 M3315.866,3608.146l-402.515,402.516 M4523.413,4010.662l-402.517,402.516 M3718.382,4010.662l402.515,402.516
M4925.928,3608.146l-402.515,402.516 M4925.928,3608.146l402.516,402.516"/>
<path fill="none" stroke="#0000FF" stroke-width="0.7087" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
M-3526.9,4010.662l402.515,402.516 M-2721.869,4010.662l-402.516,402.516 M-2319.354,3608.146l402.516,402.516 M-2319.354,3608.146
l-402.515,402.516 M-1111.807,4010.662l-402.515,402.516 M-1916.838,4010.662l402.516,402.516 M-709.291,3608.146l402.516,402.516
M-709.291,3608.146l-402.516,402.516 M498.256,4010.662L95.74,4413.178 M-306.775,4010.662L95.74,4413.178 M900.771,3608.146
l402.516,402.516 M900.771,3608.146l-402.516,402.516 M2108.318,4010.662l-402.516,402.516 M1303.287,4010.662l402.516,402.516
M2510.835,3608.146l402.517,402.516 M2510.835,3608.146l-402.517,402.516 M3718.382,4010.662l-402.516,402.516 M2913.352,4010.662
l402.515,402.516 M4120.896,3608.146l402.517,402.516 M4120.896,3608.146l-402.515,402.516 M4523.413,4010.662l402.515,402.516
M5328.443,4010.662l-402.516,402.516"/>
<path fill="none" stroke="#0000FF" stroke-width="0.7087" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
M-3526.9,4413.178l805.031,805.031 M-1916.838,4413.178l-805.031,805.031 M-1916.838,4413.178l805.031,805.031 M-306.775,4413.178
l-805.032,805.031 M-306.775,4413.178l805.031,805.031 M1303.287,4413.178l-805.031,805.031 M1303.287,4413.178l805.031,805.031
M2913.352,4413.178l-805.033,805.031 M2913.352,4413.178l805.03,805.031 M4523.413,4413.178l-805.031,805.031 M4523.413,4413.178
l805.03,805.031"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M-3526.9,3608.146h8855.344"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M-3526.9,2803.115h8855.344"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M-3526.9,1998.084h8855.344"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M-3526.9,4413.178h8855.344"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M-2721.869,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M-3124.385,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M-2319.354,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M4925.928,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M1705.803,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M2108.318,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M2510.835,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M2913.352,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M3315.866,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M3718.382,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M4120.896,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M4523.413,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M1303.287,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M900.771,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M498.256,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M95.74,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M-306.775,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M-709.291,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M-1111.807,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M-1514.322,1193.053v4025.156"/>
<path fill="none" stroke="#FF0000" stroke-miterlimit="10" d="M-1916.838,1193.053v4025.156"/>
<path fill="none" stroke="#000000" stroke-width="0.7087" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
M-3526.9,5218.209h8855.344 M5328.443,5218.209V1193.053 M5328.443,1193.053H-3526.9 M-3526.9,1193.053v4025.156"/>
</svg>
...@@ -383,15 +383,15 @@ ...@@ -383,15 +383,15 @@
<div id="threeContainer"></div> <div id="threeContainer"></div>
<canvas id="gpuMathCanvas"></canvas> <canvas id="gpuMathCanvas"></canvas>
<div id="controls"> <div id="controls">
<b>Simulation:</b><br/> <b>Simulation Type:</b><br/>
<div class="indent"> <div class="indent">
<label class="radio"> <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> <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 Compliant Dynamic Simulation
</label> </label>
<label class="radio"> <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> <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) Compliant Static Simulation (not finished yet)
</label> </label>
</div><br/> </div><br/>
<b>Fold Settings:</b><br/><br/> <b>Fold Settings:</b><br/><br/>
......
...@@ -96,6 +96,24 @@ function initControls(globals){ ...@@ -96,6 +96,24 @@ function initControls(globals){
$(e.target).blur(); $(e.target).blur();
}); });
$("#fileSelector").change(function(e){
var files = e.target.files; // FileList object
if (files.length < 1) {
console.warn("no files");
return;
}
var file = files[0];
var reader = new FileReader();
reader.onload = function(){
return function(e) {
globals.pattern.loadSVG(e.target.result);
}
}(file);
reader.readAsDataURL(file);
});
if (globals.colorMode == "color") $("#coloredMaterialOptions").show(); if (globals.colorMode == "color") $("#coloredMaterialOptions").show();
else $("#coloredMaterialOptions").hide(); else $("#coloredMaterialOptions").hide();
setRadio("colorMode", globals.colorMode, function(val){ setRadio("colorMode", globals.colorMode, function(val){
......
...@@ -40,7 +40,7 @@ function initGlobals(){ ...@@ -40,7 +40,7 @@ function initGlobals(){
density: 1, density: 1,
//import pattern settings //import pattern settings
vertTol: 1//vertex merge tolerange vertTol: 3//vertex merge tolerange
}; };
......
...@@ -121,6 +121,10 @@ function initModel(globals){ ...@@ -121,6 +121,10 @@ function initModel(globals){
} }
function buildModel(_faces, _vertices, _allEdges, allCreaseParams){ function buildModel(_faces, _vertices, _allEdges, allCreaseParams){
if (_vertices.length == 0 || _faces.length == 0 || _allEdges.length == 0) {
console.warn("bad geometry");
return;
}
var _nodes = []; var _nodes = [];
for (var i=0;i<_vertices.length;i++){ for (var i=0;i<_vertices.length;i++){
......
...@@ -20,14 +20,8 @@ function initPattern(globals){ ...@@ -20,14 +20,8 @@ function initPattern(globals){
var SVGloader = new THREE.SVGLoader(); var SVGloader = new THREE.SVGLoader();
function loadSVG(url, callback){ function loadSVG(url){
SVGloader.load(url, callback, function(){}, function(error){ SVGloader.load(url, function(svg){
alert("Error loading SVG: " + url);
console.log(error);
});
}
loadSVG("assets/Tessellations/miura-ori.svg", function(svg){
var _$svg = $(svg); var _$svg = $(svg);
//format all lines //format all lines
...@@ -66,7 +60,15 @@ function initPattern(globals){ ...@@ -66,7 +60,15 @@ function initPattern(globals){
$("#svgViewer").html($svg); $("#svgViewer").html($svg);
parseSVG($outlines, $mountains, $valleys, $cuts); parseSVG($outlines, $mountains, $valleys, $cuts);
},
function(){},
function(error){
alert("Error loading SVG: " + url);
console.log(error);
}); });
}
loadSVG("assets/Tessellations/miura-ori.svg");
function parsePath(_verticesRaw, _segmentsRaw, $paths){ function parsePath(_verticesRaw, _segmentsRaw, $paths){
for (var i=0;i<$paths.length;i++){ for (var i=0;i<$paths.length;i++){
......
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