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
95e59f6f
Commit
95e59f6f
authored
May 01, 2017
by
amandaghassaei
Browse files
working better
parent
5720d271
Changes
3
Hide whitespace changes
Inline
Side-by-side
js/dynamic/dynamicModel.js
View file @
95e59f6f
...
...
@@ -4,7 +4,7 @@
function
initDynamicModel
(
globals
){
var
material
=
new
THREE
.
MeshNormalMaterial
({
shading
:
THREE
.
FlatShading
,
side
:
THREE
.
Front
Side
});
var
material
=
new
THREE
.
MeshNormalMaterial
({
shading
:
THREE
.
FlatShading
,
side
:
THREE
.
Double
Side
});
var
geometry
=
new
THREE
.
Geometry
();
geometry
.
dynamic
=
true
;
var
object3D
=
new
THREE
.
Mesh
(
geometry
,
material
);
...
...
js/model.js
View file @
95e59f6f
...
...
@@ -16,9 +16,9 @@ function initModel(globals){
// nodes.push(new Node(new THREE.Vector3(-10,0,0), nodes.length));
nodes
[
0
].
setFixed
(
true
);
nodes
[
1
].
setFixed
(
true
);
nodes
[
2
].
setFixed
(
true
);
//
nodes[0].setFixed(true);
//
nodes[1].setFixed(true);
//
nodes[2].setFixed(true);
var
edges
=
[];
edges
.
push
(
new
Beam
([
nodes
[
1
],
nodes
[
0
]]));
...
...
@@ -43,9 +43,9 @@ function initModel(globals){
var
creases
=
[];
creases
.
push
(
new
Crease
(
edges
[
2
],
0
,
1
,
Math
.
PI
,
1
,
nodes
[
1
],
nodes
[
3
],
0
));
creases
.
push
(
new
Crease
(
edges
[
4
],
2
,
1
,
Math
.
PI
,
1
,
nodes
[
4
],
nodes
[
0
],
1
));
creases
.
push
(
new
Crease
(
edges
[
4
],
2
,
1
,
-
Math
.
PI
,
1
,
nodes
[
4
],
nodes
[
0
],
1
));
// creases.push(new Crease(edges[5], 3, 2, Math.PI, 1, nodes[3], nodes[1], 1));
// creases.push(new Crease(edges[5], 3, 2,
-
Math.PI, 1, nodes[3], nodes[1], 1));
// creases.push(new Crease(edges[0], 3, 0, Math.PI, 1, nodes[4], nodes[2], 2));
...
...
js/pattern.js
View file @
95e59f6f
...
...
@@ -32,46 +32,46 @@ function initPattern(globals){
});
}
//
loadSVG("assets/Tessellations/SimpleVertex2.svg", function(svg){
//
var _$svg = $(svg);
//
//
//format all lines
//
var $paths = _$svg.children("path");
//
$paths.css({fill:"none", 'stroke-width':3, 'stroke-dasharray':"none"});
//
//
var $outlines = $paths.filter(function(){
//
var stroke = $(this).attr("stroke").toLowerCase();
//
return stroke == "#000000" || stroke == "#000";
//
});
//
// $outlines.css({fill:'#ffffff'});
//
//
var $mountains = $paths.filter(function(){
//
var stroke = $(this).attr("stroke").toLowerCase();
//
return stroke == "#ff0000" || stroke == "#f00";
//
});
//
$mountains.css({'stroke-dasharray':'12, 6, 3, 6'});
//
//
var $valleys = $paths.filter(function(){
//
var stroke = $(this).attr("stroke").toLowerCase();
//
return stroke == "#0000ff" || stroke == "#00f";
//
});
//
$valleys.css({'stroke-dasharray':'7, 6, 7, 6'});
//
//
var $cuts = $paths.filter(function(){
//
var stroke = $(this).attr("stroke").toLowerCase();
//
return stroke == "#00ff00" || stroke == "#0f0";
//
});
//
//
var $svg = $('<svg version="1.1" viewBox="'+_$svg.attr("viewBox")+'" id="mySVG" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> </svg>');
//
$svg.append($outlines);
//
$svg.append($mountains);
//
$svg.append($valleys);
//
$svg.append($cuts);
//
//
$("#svgViewer").html($svg);
//
//
parseSVG($outlines, $mountains, $valleys, $cuts);
//
});
loadSVG
(
"
assets/Tessellations/SimpleVertex2.svg
"
,
function
(
svg
){
var
_$svg
=
$
(
svg
);
//format all lines
var
$paths
=
_$svg
.
children
(
"
path
"
);
$paths
.
css
({
fill
:
"
none
"
,
'
stroke-width
'
:
3
,
'
stroke-dasharray
'
:
"
none
"
});
var
$outlines
=
$paths
.
filter
(
function
(){
var
stroke
=
$
(
this
).
attr
(
"
stroke
"
).
toLowerCase
();
return
stroke
==
"
#000000
"
||
stroke
==
"
#000
"
;
});
// $outlines.css({fill:'#ffffff'});
var
$mountains
=
$paths
.
filter
(
function
(){
var
stroke
=
$
(
this
).
attr
(
"
stroke
"
).
toLowerCase
();
return
stroke
==
"
#ff0000
"
||
stroke
==
"
#f00
"
;
});
$mountains
.
css
({
'
stroke-dasharray
'
:
'
12, 6, 3, 6
'
});
var
$valleys
=
$paths
.
filter
(
function
(){
var
stroke
=
$
(
this
).
attr
(
"
stroke
"
).
toLowerCase
();
return
stroke
==
"
#0000ff
"
||
stroke
==
"
#00f
"
;
});
$valleys
.
css
({
'
stroke-dasharray
'
:
'
7, 6, 7, 6
'
});
var
$cuts
=
$paths
.
filter
(
function
(){
var
stroke
=
$
(
this
).
attr
(
"
stroke
"
).
toLowerCase
();
return
stroke
==
"
#00ff00
"
||
stroke
==
"
#0f0
"
;
});
var
$svg
=
$
(
'
<svg version="1.1" viewBox="
'
+
_$svg
.
attr
(
"
viewBox
"
)
+
'
" id="mySVG" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> </svg>
'
);
$svg
.
append
(
$outlines
);
$svg
.
append
(
$mountains
);
$svg
.
append
(
$valleys
);
$svg
.
append
(
$cuts
);
$
(
"
#svgViewer
"
).
html
(
$svg
);
parseSVG
(
$outlines
,
$mountains
,
$valleys
,
$cuts
);
});
function
parsePath
(
_verticesRaw
,
_segmentsRaw
,
$paths
){
for
(
var
i
=
0
;
i
<
$paths
.
length
;
i
++
){
...
...
@@ -200,7 +200,7 @@ function initPattern(globals){
creaseParams
.
push
(
i
);
if
(
i
<
(
outlines
.
length
+
mountains
.
length
+
valleys
.
length
)){
var
angle
=
Math
.
PI
/
2
;
var
angle
=
Math
.
PI
;
if
(
i
<
(
outlines
.
length
+
mountains
.
length
)){
angle
*=
-
1
;
}
...
...
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