Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OrigamiSimulator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Amanda Ghassaei
OrigamiSimulator
Commits
1678733f
Commit
1678733f
authored
Feb 24, 2017
by
amandaghassaei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ui
parent
6039dba4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
43 deletions
+60
-43
index.html
index.html
+16
-15
js/controls.js
js/controls.js
+26
-3
js/dynamicModel.js
js/dynamicModel.js
+9
-22
js/globals.js
js/globals.js
+6
-0
main.css
main.css
+3
-3
No files found.
index.html
View file @
1678733f
...
...
@@ -125,7 +125,7 @@
vec4
neighborIndices
=
texture2D
(
u_meta
,
scaledFragCoord
);
vec2
meta
=
texture2D
(
u_meta
,
scaledFragCoord
).
xy
;
for
(
int
j
=
0
;
j
<
100
;
j
++
){
//for all beams
for
(
int
j
=
0
;
j
<
100
;
j
++
){
//for all beams
(up to 100, had to put a const int in here)
if
(
j
>=
int
(
meta
[
1
]))
break
;
float
beamIndex1D
=
meta
[
0
]
+
float
(
j
);
...
...
@@ -201,30 +201,31 @@
</div>
<br/><br/>
<div
class=
"dynamicSim"
>
Dynamic Sim Settings:
<br/
>
<div
class=
"paddingBottom"
>
Dynamic Sim Settings:
</div
>
<div
class=
"indent"
>
<div
class=
"sliderContainer"
>
<span
class=
"label-slider"
>
Damping :
</span><div
id=
"damping"
class=
"flat-slider ui-slider ui-corner-all ui-slider-horizontal ui-widget ui-widget-content"
></div><br/>
</div>
<a
href=
"#"
id=
"resetDynamicSim"
class=
"btn btn-lg btn-default"
>
Replay Dynamic Simulation
</a>
<a
href=
"#"
id=
"resetDynamicSim"
class=
"paddingBottom btn btn-lg btn-default"
>
Replay Dynamic Simulation
</a>
<div>
Δ
t =
<span
id=
"deltaT"
></span>
seconds
</div>
</div>
</div>
<div
id=
"extraSpace"
></div>
</div>
<div
id=
"controls"
>
<a
href=
"#"
id=
"about"
class=
"btn btn-lg btn-default"
>
About
</a><br/><br/>
<
!--<div class="sliderInput" id="density">--
>
<
!--<span class="label-slider">Density : </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 int" type="text">--
>
<
!--</div>--
>
<
!--<div class="sliderInput" id="width">--
>
<
!--<span class="label-slider">Width (m) : </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 int" type="text">--
>
<
!--</div>--
>
<
!--<div class="sliderInput" id="length">--
>
<
!--<span class="label-slider">Length (m) : </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 int" type="text">--
>
<
!--</div>--
>
<
div
class=
"sliderInput"
id=
"axialStiffness"
>
<
span
class=
"label-slider"
>
Axial Stiffness :
</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 int"
type=
"text"
>
<
/div
>
<
div
class=
"sliderInput"
id=
"creaseStiffness"
>
<
span
class=
"label-slider"
>
Crease Stiffness :
</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 int"
type=
"text"
>
<
/div
>
<
div
class=
"sliderInput"
id=
"panelStiffness"
>
<
span
class=
"label-slider"
>
Panel Stiffness :
</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 int"
type=
"text"
>
<
/div
>
<!--<a href="#" id="addRemoveFixed" class="btn btn-lg btn-default">Add/Remove Fixed Constraint</a>-->
<!--<span class="titleSpan">Available Materials:</span>-->
<!--<div id="materialTypes" class="indent">-->
...
...
js/controls.js
View file @
1678733f
...
...
@@ -36,10 +36,32 @@ function initControls(globals){
globals
.
schematicVisible
=
val
;
});
setSlider
(
"
#damping
"
,
globals
.
percentDamping
,
0.01
,
1
,
0.01
,
function
(
val
){
setSliderInput
(
"
#axialStiffness
"
,
globals
.
axialStiffness
,
1
,
1000
,
1
,
function
(
val
){
globals
.
axialStiffness
=
val
;
globals
.
dynamicModel
.
updateMaterials
();
});
setSliderInput
(
"
#creaseStiffness
"
,
globals
.
creaseStiffness
,
1
,
1000
,
1
,
function
(
val
){
globals
.
creaseStiffness
=
val
;
});
setSliderInput
(
"
#panelStiffness
"
,
globals
.
panelStiffness
,
1
,
1000
,
1
,
function
(
val
){
globals
.
panelStiffness
=
val
;
});
setSlider
(
"
#damping
"
,
globals
.
percentDamping
,
0
,
1
,
0.01
,
function
(
val
){
globals
.
percentDamping
=
val
;
},
function
(){
// globals.resetSimFromInitialState();
globals
.
dynamicModel
.
updateMaterials
();
globals
.
dynamicModel
.
reset
();
});
function
setDeltaT
(
val
){
$
(
"
#deltaT
"
).
html
(
val
.
toFixed
(
4
));
}
setLink
(
"
#resetDynamicSim
"
,
function
(){
globals
.
dynamicModel
.
reset
();
});
function
setButtonGroup
(
id
,
callback
){
...
...
@@ -200,7 +222,8 @@ function initControls(globals){
}
return
{
update
:
update
update
:
update
,
setDeltaT
:
setDeltaT
}
}
js/dynamicModel.js
View file @
1678733f
...
...
@@ -65,16 +65,6 @@ function initDynamicModel(globals){
object3D
.
visible
=
state
;
}
function
setSelfWeight
(){
// console.log(nodes[0].getSelfWeight().length());
for
(
var
i
=
0
;
i
<
nodes
.
length
;
i
++
){
var
node
=
nodes
[
i
];
if
(
globals
.
applySelfWeight
)
globals
.
schematic
.
forces
[
i
].
setSelfWeight
(
node
.
getSelfWeight
());
else
globals
.
schematic
.
forces
[
i
].
setSelfWeight
(
new
THREE
.
Vector3
(
0
,
0
,
0
));
}
globals
.
forceArrayUpdated
();
}
function
solveStep
(){
if
(
globals
.
forceHasChanged
){
...
...
@@ -85,9 +75,9 @@ function initDynamicModel(globals){
updateFixed
();
globals
.
fixedHasChanged
=
false
;
}
if
(
globals
.
dynamicSimMaterial
sChanged
){
if
(
globals
.
materialHa
sChanged
){
updateMaterials
();
globals
.
dynamicSimMaterial
sChanged
=
false
;
globals
.
materialHa
sChanged
=
false
;
}
if
(
globals
.
shouldResetDynamicSim
){
reset
();
...
...
@@ -149,6 +139,7 @@ function initDynamicModel(globals){
globals
.
gpuMath
.
setUniformForProgram
(
"
velocityCalc
"
,
"
u_dt
"
,
dt
,
"
1f
"
);
globals
.
gpuMath
.
setProgram
(
"
positionCalc
"
);
globals
.
gpuMath
.
setUniformForProgram
(
"
positionCalc
"
,
"
u_dt
"
,
dt
,
"
1f
"
);
globals
.
controls
.
setDeltaT
(
dt
);
return
numSteps
;
}
...
...
@@ -160,12 +151,6 @@ function initDynamicModel(globals){
return
(
1
/
(
2
*
Math
.
PI
*
maxFreqNat
))
*
0.5
;
//half of max delta t for good measure
}
function
updateTextures
(
gpuMath
){
gpuMath
.
initTextureFromData
(
"
u_originalPosition
"
,
textureDim
,
textureDim
,
"
FLOAT
"
,
originalPosition
,
true
);
gpuMath
.
initTextureFromData
(
"
u_meta
"
,
textureDim
,
textureDim
,
"
FLOAT
"
,
meta
,
true
);
reset
();
}
function
initTexturesAndPrograms
(
gpuMath
){
var
vertexShader
=
document
.
getElementById
(
"
vertexShader
"
).
text
;
...
...
@@ -222,7 +207,7 @@ function initDynamicModel(globals){
return
0
;
}
function
updateMaterials
(){
function
updateMaterials
(
shouldUpdateLength
){
var
index
=
0
;
for
(
var
i
=
0
;
i
<
nodes
.
length
;
i
++
){
meta
[
4
*
i
]
=
index
;
...
...
@@ -231,7 +216,7 @@ function initDynamicModel(globals){
var
beam
=
nodes
[
i
].
beams
[
j
];
beamMeta
[
4
*
index
]
=
beam
.
getK
();
beamMeta
[
4
*
index
+
1
]
=
beam
.
getD
();
beamMeta
[
4
*
index
+
2
]
=
beam
.
getLength
();
if
(
shouldUpdateLength
)
beamMeta
[
4
*
index
+
2
]
=
beam
.
getLength
();
beamMeta
[
4
*
index
+
3
]
=
beam
.
getOtherNode
(
nodes
[
i
]).
getIndex
();
index
+=
1
;
}
...
...
@@ -297,7 +282,7 @@ function initDynamicModel(globals){
});
updateOriginalPosition
();
updateMaterials
();
updateMaterials
(
true
);
updateFixed
();
updateExternalForces
();
}
...
...
@@ -311,6 +296,8 @@ function initDynamicModel(globals){
getChildren
:
getChildren
,
setViewMode
:
setViewMode
,
syncNodesAndEdges
:
syncNodesAndEdges
,
updateOriginalPosition
:
updateOriginalPosition
updateOriginalPosition
:
updateOriginalPosition
,
updateMaterials
:
updateMaterials
,
reset
:
reset
}
}
\ No newline at end of file
js/globals.js
View file @
1678733f
...
...
@@ -7,6 +7,12 @@ function initGlobals(){
var
_globals
=
{
//flags
fixedHasChanged
:
false
,
forceHasChanged
:
false
,
materialHasChanged
:
false
,
shouldResetDynamicSim
:
false
,
//3d vis
dynamicSimVisible
:
true
,
staticSimVisible
:
false
,
...
...
main.css
View file @
1678733f
...
...
@@ -249,7 +249,7 @@ span.modal-close{
}
.sliderInput
>
.flat-slider
{
width
:
1
6
2px
;
width
:
1
3
2px
;
}
.label-slider
{
...
...
@@ -281,6 +281,6 @@ span.modal-close{
text-align
:
left
;
}
#
paddingBottom
{
margin-bottom
:
5
0px
;
.
paddingBottom
{
margin-bottom
:
2
0px
;
}
Write
Preview
Markdown
is supported
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