Commit c7a6988e authored by amandaghassaei's avatar amandaghassaei
Browse files

cleaning up

parent 2bdd5a4e
......@@ -2,7 +2,7 @@
* Created by ghassaei on 10/7/16.
*/
function initDynamicModel(globals){
function initDynamicSolver(globals){
globals.gpuMath = initGPUMath();
......@@ -175,7 +175,7 @@ function initDynamicModel(globals){
}
function setSolveParams(){
var dt = calcDt()/10;//todo this is weird
var dt = calcDt()/10;//todo factor of ten?
var numSteps = 0.5/dt;
globals.gpuMath.setProgram("thetaCalc");
globals.gpuMath.setUniformForProgram("thetaCalc", "u_dt", dt, "1f");
......
......@@ -118,9 +118,7 @@ $(function() {
globals = initGlobals();
globals.model = initModel(globals);
globals.staticSolver = initStaticSolver(globals);
globals.dynamicModel = initDynamicModel(globals);
// globals.dynamicModel.syncNodesAndEdges(true);
// globals.staticSolver.syncNodesAndEdges();
globals.dynamicSolver = initDynamicSolver(globals);
globals.pattern = initPattern(globals);
// globals.threeView.sceneAdd(raycasterPlane);
});
\ No newline at end of file
......@@ -116,7 +116,7 @@ function initModel(globals){
globals.threeView.startAnimation(function(){
if (!inited) return;
if (globals.simType == "dynamic"){
globals.dynamicModel.solve();
globals.dynamicSolver.solve();
} else {
console.log("static");
}
......
......@@ -178,7 +178,9 @@ function initPattern(globals){
function getFacesAndVerticesForEdges(faces, allEdges){
//todo merge this
var allCreaseParams = [];//face1Ind, vertInd, face2Ind, ver2Ind, edgeInd, angle
for (var i=outlines.length;i<outlines.length+mountains.length+valleys.length;i++){
for (var i=outlines.length;i<allEdges.length;i++){
if (i>=outlines.length+mountains.length+valleys.length &&
i<outlines.length+mountains.length+valleys.length+cuts.length) continue;
var v1 = allEdges[i][0];
var v2 = allEdges[i][1];
var creaseParams = [];
......@@ -221,42 +223,6 @@ 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) {
if (v2Index-v1Index == 1 || v2Index-v1Index == -2) {
creaseParams = [creaseParams[2], creaseParams[3], creaseParams[0], creaseParams[1]];
}
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