Commit 15196d5b authored by amandaghassaei's avatar amandaghassaei
Browse files

panel vs crease

parent 95e59f6f
......@@ -132,6 +132,10 @@ function initDynamicModel(globals){
updateCreasesMeta();
globals.creaseMaterialHasChanged = false;
}
if (globals.materialHasChanged) {
updateMaterials();
globals.materialHasChanged = false;
}
if (globals.shouldResetDynamicSim) {
reset();
globals.shouldResetDynamicSim = false;
......@@ -393,6 +397,7 @@ function initDynamicModel(globals){
function updateCreasesMeta(initing){
for (var i=0;i<creases.length;i++){
var crease = creases[i];
console.log(crease.getK());
creaseMeta[i*4] = crease.getK();
creaseMeta[i*4+1] = crease.getD();
if (initing) creaseMeta[i*4+2] = crease.getTargetTheta();
......
......@@ -33,7 +33,7 @@ function initGlobals(){
density: 1,
//import pattern settings
vertTol: 0.1//vertex merge tolerange
vertTol: 1//vertex merge tolerange
};
......
......@@ -121,7 +121,7 @@ $(function() {
globals.model = initModel(globals);
globals.staticSolver = initStaticSolver(globals);
globals.dynamicModel = initDynamicModel(globals);
globals.dynamicModel.syncNodesAndEdges(true);
// globals.dynamicModel.syncNodesAndEdges(true);
// globals.staticSolver.syncNodesAndEdges();
globals.pattern = initPattern(globals);
globals.threeView.render();
......
......@@ -79,7 +79,7 @@ function initModel(globals){
var _creases = [];
for (var i=0;i<allCreaseParams.length;i++) {//allCreaseParams.length
var creaseParams = allCreaseParams[i];//face1Ind, vertInd, face2Ind, ver2Ind, edgeInd, angle
_creases.push(new Crease(_edges[creaseParams[4]], creaseParams[0], creaseParams[2], creaseParams[5], 1, _nodes[creaseParams[1]], _nodes[creaseParams[3]], _creases.length));
_creases.push(new Crease(_edges[creaseParams[4]], creaseParams[0], creaseParams[2], creaseParams[5], creaseParams[5]!=0, _nodes[creaseParams[1]], _nodes[creaseParams[3]], _creases.length));
}
globals.threeView.sceneClearModel();
......
......@@ -32,7 +32,7 @@ function initPattern(globals){
});
}
loadSVG("assets/Tessellations/SimpleVertex2.svg", function(svg){
loadSVG("assets/Tessellations/SimpleVertex.svg", function(svg){
var _$svg = $(svg);
//format all lines
......@@ -209,7 +209,6 @@ function initPattern(globals){
console.log("panel");
creaseParams.push(0);
}
console.log(creaseParams);
allCreaseParams.push(creaseParams);
break;
}
......@@ -218,36 +217,36 @@ function initPattern(globals){
}
}
//panels
// for (var i=outlines.length+mountains.length+valleys.length+cuts.length;i<allEdges.length;i++){
// var v1 = allEdges[i][0];
// var v2 = allEdges[i][1];
// var creaseParams = [];
// for (var j=0;j<faces.length;j++){
// var face = faces[j];
// var faceVerts = [face.a, face.b, face.c];
// var v1Index = faceVerts.indexOf(v1);
// if (v1Index>=0){
// var v2Index = faceVerts.indexOf(v2);
// if (v2Index>=0){
// creaseParams.push(j);
// if (v2Index>v1Index) {
// faceVerts.splice(v2Index, 1);
// faceVerts.splice(v1Index, 1);
// } else {
// faceVerts.splice(v1Index, 1);
// faceVerts.splice(v2Index, 1);
// }
// creaseParams.push(faceVerts[0]);
// if (creaseParams.length == 4) {
// creaseParams.push(i);
// creaseParams.push(0);//zero target angle
// allCreaseParams.push(creaseParams);
// break;
// }
// }
// }
// }
// }
for (var i=outlines.length+mountains.length+valleys.length+cuts.length;i<allEdges.length;i++){
var v1 = allEdges[i][0];
var v2 = allEdges[i][1];
var creaseParams = [];
for (var j=0;j<faces.length;j++){
var face = faces[j];
var faceVerts = [face.a, face.b, face.c];
var v1Index = faceVerts.indexOf(v1);
if (v1Index>=0){
var v2Index = faceVerts.indexOf(v2);
if (v2Index>=0){
creaseParams.push(j);
if (v2Index>v1Index) {
faceVerts.splice(v2Index, 1);
faceVerts.splice(v1Index, 1);
} else {
faceVerts.splice(v1Index, 1);
faceVerts.splice(v2Index, 1);
}
creaseParams.push(faceVerts[0]);
if (creaseParams.length == 4) {
creaseParams.push(i);
creaseParams.push(0);//zero target angle
allCreaseParams.push(creaseParams);
break;
}
}
}
}
}
return allCreaseParams;
}
......
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