Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amanda Ghassaei
OrigamiSimulator
Commits
a66ff6eb
Commit
a66ff6eb
authored
May 24, 2017
by
amandaghassaei
Browse files
small changes
parent
bd4453c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
index.html
View file @
a66ff6eb
...
...
@@ -305,11 +305,10 @@
if
(
diff
<
-
5.0
)
{
diff
+=
TWO_PI
;
}
else
if
(
diff
>
5.0
)
{
diff
-=
TWO_PI
;
diff
-=
TWO_PI
;
}
//if (abs(diff)>0.01) diff = 0.0;
theta
=
lastTheta
[
0
]
+
diff
;
gl_FragColor
=
vec4
(
theta
,
origD
iff
,
lastTheta
[
2
],
lastTheta
[
3
]);
//[theta, w, normal1Index, normal2Index]
gl_FragColor
=
vec4
(
theta
,
d
iff
,
lastTheta
[
2
],
lastTheta
[
3
]);
//[theta, w, normal1Index, normal2Index]
}
</script>
...
...
@@ -540,7 +539,7 @@
<b>
Animation Settings:
</b><a
class=
"about floatRight"
href=
"#"
id=
"aboutAnimation"
><span
class=
"fui-question-circle"
></span></a><br/>
<div
class=
"indent"
>
<span
class=
"smallTxt"
>
Δ
t =
<span
id=
"deltaT"
></span>
seconds
</span><br/>
<span
class=
"smallTxt"
>
Num steps per render:
<input
id=
"numStepsPerRender"
value=
""
placeholder=
""
class=
"int form-control"
type=
"text"
></span><br/><br/>
<span
class=
"smallTxt"
>
Num
simulation
steps per render:
<input
id=
"numStepsPerRender"
value=
""
placeholder=
""
class=
"int form-control"
type=
"text"
></span><br/><br/>
<a
href=
"#"
id=
"shouldCenterGeo"
class=
"floatRight btn btn-lg btn-default"
>
Re-center geometry
</a>
</div>
<div
class=
"extraSpace"
></div>
...
...
@@ -727,7 +726,7 @@
This is especially cool if you set the mesh material to
<b>
Axial Strain Visualization
</b>
so you can see how your interactions
change the internal strains in the material.
<br/><br/>
If the simulation looks choppy, consider lowering the
<b>
Num s
teps
per render
</b>
setting in the right hand menu.
If the simulation looks choppy, consider lowering the
<b>
Num s
imulation
per render
</b>
setting in the right hand menu.
</p>
</div>
</div>
<!-- /.modal-content -->
...
...
@@ -746,7 +745,7 @@
based on the material stiffnesses set in the
<b>
Stiffness Settings
</b>
section: more stiff settings
require shorter time steps to solve and will slow down the simulation.
<br/>
<br/>
<b>
Num steps per render
</b>
allows you to control the number of tiny time steps forward to take on each
<b>
Num
simulation
steps per render
</b>
allows you to control the number of tiny time steps forward to take on each
render cycle. If the simulation looks choppy to you, you might consider lowering this setting.
Lowering the number of steps per render will slow down the simulation, but will result in a more smooth animation.
</p>
...
...
js/dynamic/dynamicSolver.js
View file @
a66ff6eb
...
...
@@ -158,28 +158,28 @@ function initDynamicSolver(globals){
function
render
(){
//
var vectorLength = 2;
//
globals.gpuMath.setProgram("packToBytes");
//
globals.gpuMath.setUniformForProgram("packToBytes", "u_vectorLength", vectorLength, "1f");
//
globals.gpuMath.setUniformForProgram("packToBytes", "u_floatTextureDim", [textureDimCreases, textureDimCreases], "2f");
//
globals.gpuMath.setSize(textureDimCreases*vectorLength, textureDimCreases);
//
globals.gpuMath.step("packToBytes", ["u_lastTheta"], "outputBytes");
//
//
if (globals.gpuMath.readyToRead()) {
//
var numPixels = nodes.length*vectorLength;
//
var height = Math.ceil(numPixels/(textureDimCreases*vectorLength));
//
var pixels = new Uint8Array(height*textureDimCreases*4*vectorLength);
//
globals.gpuMath.readPixels(0, 0, textureDimCreases * vectorLength, height, pixels);
//
var parsedPixels = new Float32Array(pixels.buffer);
//
for (var i=0;i<parsedPixels.length;i+=2){
//
if (Math.abs(parsedPixels[i])>Math.PI) {
//
console.log(
crease
s[i]);
//
}
//
//
}
//
} else {
//
console.log("here");
//
}
var
vectorLength
=
2
;
globals
.
gpuMath
.
setProgram
(
"
packToBytes
"
);
globals
.
gpuMath
.
setUniformForProgram
(
"
packToBytes
"
,
"
u_vectorLength
"
,
vectorLength
,
"
1f
"
);
globals
.
gpuMath
.
setUniformForProgram
(
"
packToBytes
"
,
"
u_floatTextureDim
"
,
[
textureDimCreases
,
textureDimCreases
],
"
2f
"
);
globals
.
gpuMath
.
setSize
(
textureDimCreases
*
vectorLength
,
textureDimCreases
);
globals
.
gpuMath
.
step
(
"
packToBytes
"
,
[
"
u_lastTheta
"
],
"
outputBytes
"
);
if
(
globals
.
gpuMath
.
readyToRead
())
{
var
numPixels
=
nodes
.
length
*
vectorLength
;
var
height
=
Math
.
ceil
(
numPixels
/
(
textureDimCreases
*
vectorLength
));
var
pixels
=
new
Uint8Array
(
height
*
textureDimCreases
*
4
*
vectorLength
);
globals
.
gpuMath
.
readPixels
(
0
,
0
,
textureDimCreases
*
vectorLength
,
height
,
pixels
);
var
parsedPixels
=
new
Float32Array
(
pixels
.
buffer
);
for
(
var
i
=
0
;
i
<
parsedPixels
.
length
;
i
+=
2
){
if
(
Math
.
abs
(
parsedPixels
[
i
])
>
Math
.
PI
)
{
console
.
log
(
parsedPixel
s
[
i
+
1
]);
//theta
}
}
}
else
{
console
.
log
(
"
here
"
);
}
var
vectorLength
=
4
;
globals
.
gpuMath
.
setProgram
(
"
packToBytes
"
);
...
...
js/pattern.js
View file @
a66ff6eb
...
...
@@ -219,15 +219,16 @@ function initPattern(globals){
removeRedundantVertices
(
outlines
.
concat
(
mountains
).
concat
(
valleys
).
concat
(
cuts
).
concat
(
triangulations
));
var
allEdges
=
outlines
.
concat
(
mountains
).
concat
(
valleys
).
concat
(
cuts
).
concat
(
triangulations
);
var
preTriLength
=
allEdges
.
length
;
polygons
=
findPolygons
(
allEdges
);
var
faces
=
triangulatePolys
(
polygons
,
allEdges
);
$
(
"
#numMtns
"
).
html
(
"
(
"
+
mountains
.
length
+
"
)
"
);
$
(
"
#numValleys
"
).
html
(
"
(
"
+
valleys
.
length
+
"
)
"
);
$
(
"
#numFacets
"
).
html
(
"
(
"
+
triangulations
.
length
+
"
)
"
);
$
(
"
#numFacets
"
).
html
(
"
(
"
+
(
triangulations
.
length
+
allEdges
.
length
-
preTriLength
)
+
"
)
"
);
$
(
"
#numPassive
"
).
html
(
"
(
"
+
outlines
.
length
+
"
)
"
);
polygons
=
findPolygons
(
allEdges
);
var
faces
=
triangulatePolys
(
polygons
,
allEdges
);
var
allCreaseParams
=
getFacesAndVerticesForEdges
(
faces
,
allEdges
);
globals
.
model
.
buildModel
(
faces
,
vertices
,
allEdges
,
allCreaseParams
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment