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
25eaf017
Commit
25eaf017
authored
May 07, 2017
by
amandaghassaei
Browse files
fixing svg import
parent
ff89dd6c
Changes
7
Hide whitespace changes
Inline
Side-by-side
assets/Origami/randlettflappingbird.svg
0 → 100644
View file @
25eaf017
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
version=
"1.1"
id=
"Layer_2"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
x=
"0px"
y=
"0px"
width=
"3456px"
height=
"6912px"
viewBox=
"0 0 3456 6912"
enable-background=
"new 0 0 3456 6912"
xml:space=
"preserve"
>
<path
fill=
"none"
stroke=
"#000000"
stroke-miterlimit=
"10"
d=
"M2109,3837h-762v-762h762V3837z"
/>
<path
fill=
"none"
stroke=
"#0000FF"
stroke-miterlimit=
"10"
d=
"M1347,3837l762-762 M1347,3175.333l54.474,8.596 M1420.323,3148.323
l-18.849,35.606 M1420.323,3148.323L1347,3075 M1588.568,3316.568l520.502,520.361 M1530.98,3442.9l-129.507-258.97
M1854.789,3328.936L1918.303,3456 M1455.93,3129.473l-8.596-54.473 M1455.93,3129.473l-35.606,18.85 M1455.93,3129.473
l258.971,129.508 M1727.941,3646.303l-127.005-63.514"
/>
<path
fill=
"none"
stroke=
"#FF0000"
stroke-miterlimit=
"10"
d=
"M1728,3455.859v190.444 M1347,3402.593l183.98,40.307
M1588.568,3316.568L1530.98,3442.9 M1600.937,3582.789L1530.98,3442.9 M1401.474,3183.93L1347,3075 M1420.323,3148.323
l168.246,168.246 M1918.303,3456H1727.86 M1918.303,3455.858L2109,3075 M1674.593,3075l40.308,183.98 M1714.901,3258.98
l-126.332,57.588 M1714.901,3258.98l139.888,69.955 M1455.93,3129.473L1347,3075 M1347,3837l380.941-190.697 M1982.401,3836.93
l-254.46-190.627 M2108.965,3710.019l-190.627-254.46"
/>
</svg>
assets/
Tessellations
/singlesquaretwist.svg
→
assets/
Origami
/singlesquaretwist.svg
View file @
25eaf017
File moved
assets/
Tessellations
/squaretwistManyAngles.svg
→
assets/
Origami
/squaretwistManyAngles.svg
View file @
25eaf017
File moved
index.html
View file @
25eaf017
...
...
@@ -409,13 +409,24 @@
<li
class=
"dropdown-submenu"
>
<a
tabindex=
"-1"
>
Demo Files
<span
class=
"pull-right fui-arrow-right"
></span></a>
<ul
class=
"dropdown-menu"
>
<li><a
href=
"#"
class=
"demo"
data-url=
"Tessellations/miura-ori.svg"
>
Miura-Ori
</a></li>
<li><a
href=
"#"
class=
"demo"
data-url=
"Tessellations/waterbomb.svg"
>
Waterbomb (six-crease base)
</a></li>
<li><a
href=
"#"
class=
"demo"
data-url=
"Tessellations/waterbombTwist.svg"
>
Waterbomb (eight-crease base)
</a></li>
<li><a
href=
"#"
class=
"demo"
data-url=
"Tessellations/singlesquaretwist.svg"
>
Square Twist (single)
</a></li>
<li><a
href=
"#"
class=
"demo"
data-url=
"Tessellations/squaretwistManyAngles.svg"
>
Square Twist (many angles)
</a></li>
<li><a
href=
"#"
class=
"demo"
data-url=
"Tessellations/reschtritessellation.svg"
>
Resch Triangle Tessellation
</a></li>
<li><a
href=
"#"
class=
"demo"
data-url=
"Origami/hypar.svg"
>
Hypar (not fully working yet)
</a></li>
<li
class=
"dropdown-submenu"
>
<a
tabindex=
"-1"
>
Origami
<span
class=
"pull-right fui-arrow-right"
></span></a>
<ul
class=
"dropdown-menu"
>
<li><a
href=
"#"
class=
"demo"
data-url=
"Origami/randlettflappingbird.svg"
>
Randlett Flapping Bird
</a></li>
<li><a
href=
"#"
class=
"demo"
data-url=
"Origami/singlesquaretwist.svg"
>
Square Twist (single)
</a></li>
<li><a
href=
"#"
class=
"demo"
data-url=
"Origami/squaretwistManyAngles.svg"
>
Square Twist (many angles)
</a></li>
<li><a
href=
"#"
class=
"demo"
data-url=
"Origami/hypar.svg"
>
Hypar (not fully working yet)
</a></li>
</ul>
</li>
<li
class=
"dropdown-submenu"
>
<a
tabindex=
"-1"
>
Tesselations
<span
class=
"pull-right fui-arrow-right"
></span></a>
<ul
class=
"dropdown-menu"
>
<li><a
href=
"#"
class=
"demo"
data-url=
"Tessellations/miura-ori.svg"
>
Miura-Ori
</a></li>
<li><a
href=
"#"
class=
"demo"
data-url=
"Tessellations/waterbomb.svg"
>
Waterbomb (six-crease base)
</a></li>
<li><a
href=
"#"
class=
"demo"
data-url=
"Tessellations/waterbombTwist.svg"
>
Waterbomb (eight-crease base)
</a></li>
<li><a
href=
"#"
class=
"demo"
data-url=
"Tessellations/reschtritessellation.svg"
>
Resch Triangle Tessellation
</a></li>
</ul>
</li>
<li
class=
"divider"
></li>
<li><a
href=
"#"
class=
"demo"
data-url=
"Curved/creaseMesh.txt"
>
Curved Crease 1
</a></li>
</ul>
...
...
js/importer.js
View file @
25eaf017
...
...
@@ -257,7 +257,7 @@ function initImporter(globals){
break
;
case
2
:
//crease
creaseParams
.
push
(
Math
.
PI
);
creaseParams
.
push
(
Math
.
PI
);
//todo only mtn
break
;
}
if
(
!
shouldSkip
)
allCreaseParams
.
push
(
creaseParams
);
...
...
js/model.js
View file @
25eaf017
...
...
@@ -24,11 +24,12 @@ function initModel(globals){
var
vertices
=
[];
function
setMeshMaterial
()
{
var
polygonOffset
=
2
;
if
(
globals
.
colorMode
==
"
normal
"
)
{
material
=
new
THREE
.
MeshNormalMaterial
({
shading
:
THREE
.
FlatShading
,
side
:
THREE
.
DoubleSide
,
polygonOffset
:
true
,
polygonOffsetFactor
:
1
,
// positive value pushes polygon further away
polygonOffsetFactor
:
polygonOffset
,
// positive value pushes polygon further away
polygonOffsetUnits
:
1
});
object3D2
.
visible
=
false
;
...
...
@@ -36,7 +37,7 @@ function initModel(globals){
material
=
new
THREE
.
MeshBasicMaterial
({
vertexColors
:
THREE
.
VertexColors
,
side
:
THREE
.
DoubleSide
,
polygonOffset
:
true
,
polygonOffsetFactor
:
1
,
// positive value pushes polygon further away
polygonOffsetFactor
:
polygonOffset
,
// positive value pushes polygon further away
polygonOffsetUnits
:
1
});
object3D2
.
visible
=
false
;
...
...
@@ -44,13 +45,13 @@ function initModel(globals){
material
=
new
THREE
.
MeshPhongMaterial
({
shading
:
THREE
.
FlatShading
,
color
:
0xff0000
,
side
:
THREE
.
FrontSide
,
polygonOffset
:
true
,
polygonOffsetFactor
:
1
,
// positive value pushes polygon further away
polygonOffsetFactor
:
polygonOffset
,
// positive value pushes polygon further away
polygonOffsetUnits
:
1
});
material2
=
new
THREE
.
MeshPhongMaterial
({
shading
:
THREE
.
FlatShading
,
color
:
0x0000ff
,
side
:
THREE
.
BackSide
,
polygonOffset
:
true
,
polygonOffsetFactor
:
1
,
// positive value pushes polygon further away
polygonOffsetFactor
:
polygonOffset
,
// positive value pushes polygon further away
polygonOffsetUnits
:
1
});
material
.
color
.
setStyle
(
"
#
"
+
globals
.
color1
);
...
...
js/pattern.js
View file @
25eaf017
...
...
@@ -43,7 +43,7 @@ function initPattern(globals){
if
(
stroke
==
"
#ff0000
"
||
stroke
==
"
#f00
"
){
var
opacity
=
parseFloat
(
$
(
this
).
attr
(
"
opacity
"
));
if
(
isNaN
(
opacity
))
opacity
=
1
;
_mountainAngles
.
push
(
-
opacity
*
Math
.
PI
);
_mountainAngles
.
push
(
opacity
*
Math
.
PI
);
return
true
;
}
return
false
;
...
...
@@ -54,7 +54,7 @@ function initPattern(globals){
if
(
stroke
==
"
#0000ff
"
||
stroke
==
"
#00f
"
){
var
opacity
=
parseFloat
(
$
(
this
).
attr
(
"
opacity
"
));
if
(
isNaN
(
opacity
))
opacity
=
1
;
_valleyAngles
.
push
(
opacity
*
Math
.
PI
);
_valleyAngles
.
push
(
-
opacity
*
Math
.
PI
);
return
true
;
}
return
false
;
...
...
@@ -268,6 +268,8 @@ function initPattern(globals){
var
combined
=
[];
var
mergedVertices
=
[];
var
_weededVertices
=
vertices
.
slice
();
var
goodVertices
=
[];
var
allEdges
=
outlines
.
concat
(
mountains
).
concat
(
valleys
).
concat
(
cuts
).
concat
(
triangulations
);
var
js
=
[];
for
(
var
i
=
0
;
i
<
vertices
.
length
;
i
++
){
js
.
push
(
i
);
...
...
@@ -293,6 +295,15 @@ function initPattern(globals){
js
.
splice
(
indicesToRemove
[
k
],
1
);
}
i
-=
numCombined
;
}
else
{
// var vertexEdges = [];
// for (k=0;k<allEdges.length;k++){
// if (allEdges[k][0] == i || allEdges[k][1] == i) vertexEdges.push(k);
// }
// if (vertexEdges.length>2){
// goodVertices.push([vertices[i], i].concat(vertexEdges));
// _weededVertices.splice(i, 1);
// }
}
}
...
...
@@ -312,7 +323,6 @@ function initPattern(globals){
}
}
}
if
(
_weededVertices
.
length
>
0
){
alert
(
"
Some vertices are not fully connected, try increasing vertex merge tolerance
"
);
return
;
...
...
@@ -323,7 +333,19 @@ function initPattern(globals){
removeCombinedFromSet
(
combined
,
valleys
);
removeCombinedFromSet
(
combined
,
cuts
);
removeCombinedFromSet
(
combined
,
triangulations
);
vertices
=
mergedVertices
;
// for (var i=0;i<goodVertices.length;i++){
// var newIndex = mergedVertices.length;
// var oldIndex = goodVertices[i][1];
// mergedVertices.push(goodVertices[i][0]);
// for (var j=0;j<goodVertices[i].length-2;j++){
// var edge = allEdges[goodVertices[i][j+2]];
// console.log(goodVertices[i][j+2]);
// edge[edge.indexOf(oldIndex)] = newIndex;
// }
// }
vertices
=
mergedVertices
.
concat
(
goodVertices
);
}
function
findStrayVertices
(){
...
...
@@ -463,6 +485,7 @@ function initPattern(globals){
if
(
allEdges
[
j
][
1
]
==
i
)
vertEdges
[
i
].
push
(
j
);
}
if
(
vertEdges
[
i
].
length
<
2
){
//check that all vertices have at least two edges
console
.
log
(
vertEdges
[
i
].
length
);
alert
(
"
Some vertices are not fully connected, try increasing vertex merge tolerance
"
);
return
;
}
...
...
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