Commit a05dc6d5 authored by amandaghassaei's avatar amandaghassaei

cuts working

parent ef27677b
<?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_1" 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">
<rect x="320.648" y="1410.477" fill="none" stroke="#000000" stroke-miterlimit="10" width="1206.951" height="1751.887"/>
<path fill="none" stroke="#0000FF" d="M849.615,1695.011h147.141 M892.637,1842.866H745.496 M951.49,1842.866h147.139
M849.615,1990.719h147.141 M849.615,2286.42h147.141 M745.756,2138.57h147.137 M641.242,1990.719h147.139 M641.242,2286.42h147.139
M537.572,2138.57h147.137 M433.41,2286.42h147.139 M952.617,2138.57l149.021-1.306 M1204.705,1989.412h-147.131 M1204.705,2285.113
h-147.131 M1308.381,2137.265h-147.139 M1409.949,2285.113h-147.139 M997.484,2877.24H850.346 M954.463,2729.385h147.139
M895.609,2729.385H745.471 M997.484,2581.529H850.346 M1101.348,2433.684H954.205 M1205.857,2581.529h-147.139 M1309.531,2433.684
h-147.145 M894.486,2433.684l-149.029,1.303 M642.391,2582.839h147.137 M538.719,2434.986h147.135"/>
<path fill="none" stroke="#FF0000" stroke-linecap="round" stroke-linejoin="round" d="M849.625,1621.098H996.75 M789.305,1695.023
l60.311-0.013 M996.756,1695.011l58.84,0.013 M849.625,1768.946h44.137 M952.617,1768.946h44.133 M892.637,1842.866h58.854
M849.625,1916.799h44.137 M952.617,1916.799h44.133 M1057.486,1915.493h44.141 M1101.627,1767.646h58.914 M745.166,1768.946
h-59.762 M745.166,1916.799h44.742 M581.746,1842.873h59.525 M480.188,1916.799h57.422 M641.271,2064.646h44.133 M745.768,2064.646
h44.141 M849.625,2064.646h44.137 M952.617,2064.646h44.133 M1057.486,2063.342h44.141 M849.615,1990.719h-61.234
M1057.574,1989.412h-60.818 M1204.682,1841.569h59.521 M1160.541,2063.345h44.141 M1308.342,1915.493h57.422 M1308.342,2211.194
h-44.139 M1204.682,2211.194h-44.141 M1101.627,2211.194h-44.502 M996.75,2212.5h-44.133 M893.762,2212.494h-44.137
M789.908,2213.212h-44.141 M685.404,2212.494h-44.133 M581.746,2212.5h-44.137 M684.709,2138.57h61.047 M892.893,2138.57h59.725
M1101.639,2137.265h59.604 M997.471,2951.154H850.354 M1057.797,2877.229l-60.312,0.012 M850.346,2877.24l-58.844-0.012
M997.471,2803.305h-44.133 M894.486,2803.305h-44.133 M954.463,2729.385h-58.854 M997.471,2655.456h-44.133 M894.486,2655.456
h-44.133 M789.611,2656.759h-44.141 M745.471,2804.604h-58.914 M1101.93,2803.305h59.762 M1101.93,2655.456h-44.734
M1265.348,2729.379h-59.529 M1366.908,2655.456h-57.428 M1205.818,2507.602h-44.127 M1101.328,2507.602h-44.133 M997.471,2507.602
h-44.133 M894.486,2507.602h-44.133 M789.611,2508.909h-44.141 M997.484,2581.529h61.234 M789.527,2582.839h60.818
M642.422,2730.682h-59.527 M686.557,2508.906h-44.135 M538.754,2656.759h-57.422 M538.754,2361.059h44.141 M642.422,2361.059
h44.135 M745.471,2361.059h44.5 M850.354,2359.755h44.133 M953.338,2359.755h44.133 M1057.195,2359.04h44.133 M1161.691,2359.755
h44.135 M1265.354,2359.755h44.133 M1162.387,2433.684h-61.039 M954.205,2433.684h-59.719 M745.457,2434.986h-59.604
M433.41,2286.42H320.648 M1411.328,2285.784H1527.6 M580.549,2286.42h60.693 M788.381,2286.42h61.234 M996.756,2286.42h60.818
M1204.705,2285.113h58.105"/>
<path fill="none" stroke="#00FF00" d="M849.625,1621.098v147.849 M996.75,1621.098v147.849 M1055.596,1695.023v73.926
M789.305,1695.023v73.926 M789.305,1768.949l-44.139-0.003 M1098.281,1768.946 M745.166,1768.946v147.853 M952.617,1768.946
v147.853 M996.75,1916.799v147.848 M893.762,1768.946v147.853 M849.625,1916.799v147.848 M952.617,2064.646v147.848
M893.762,2064.646v147.848 M996.75,2212.5v147.843 M849.625,2212.5v147.843 M789.908,1916.799v147.848 M745.768,2064.646v147.848
M789.908,2213.212v147.847 M685.404,1768.946v147.853 M685.383,1916.792h-44.141 M641.271,1842.873v221.773 M685.404,2064.646
v147.848 M641.271,2212.5v147.843 M581.746,1842.873v221.773 M581.711,2064.643h-44.139 M537.609,1916.799V2212.5 M581.746,2212.5
v147.843 M480.188,1916.799V2212.5 M480.145,2212.494h-44.141 M1101.627,1767.646v147.847 M954.508,1767.646 M954.508,1915.493
M1057.486,1915.493v147.849 M1101.627,2063.345v147.85 M1057.125,2211.194v147.846 M1098.281,1842.873 M1057.498,1767.646
M1056.658,1767.634h43.268 M1160.541,1767.646v147.847 M1160.566,1915.486h44.139 M1204.682,1841.569v221.775 M1160.541,2063.345
v147.85 M1204.682,2211.194v147.846 M1264.203,1841.569v221.775 M1264.24,2063.339h44.141 M1308.342,1915.493v295.701
M1264.203,2211.194v147.846 M1365.764,1915.493v295.701 M1365.809,2211.189h44.141 M1409.898,2211.194v147.846 M435.08,2211.08
v149.405 M997.471,2951.154v-147.85 M850.354,2951.154v-147.85 M791.502,2877.229v-73.927 M1057.797,2877.229v-73.927
M1057.797,2803.302l44.133,0.003 M1101.93,2803.305v-147.849 M894.486,2803.305v-147.849 M850.354,2655.456v-147.854
M953.338,2803.305v-147.849 M997.471,2655.456v-147.854 M894.486,2507.602v-147.847 M953.338,2507.602v-147.847 M1057.195,2655.456
v-147.854 M1101.328,2507.602v-147.847 M1161.691,2803.305v-147.849 M1161.717,2655.462h44.141 M1205.818,2729.379v-221.777
M1161.691,2507.602v-147.847 M1265.348,2729.379v-221.777 M1265.391,2507.605h44.141 M1309.48,2655.456l0.006-295.701
M1366.908,2655.456v-295.701 M1366.953,2359.755h44.146 M745.471,2804.604v-147.845 M892.596,2804.604 M892.596,2656.759
M789.611,2656.759v-147.85 M745.471,2508.906v-147.848 M748.816,2729.379 M686.557,2804.604v-147.845 M686.531,2656.765h-44.141
M642.422,2730.682v-221.775 M686.557,2508.906v-147.848 M582.895,2730.682v-221.775 M582.857,2508.913h-44.139 M538.754,2656.759
v-295.7 M481.332,2656.759v-295.7 M481.289,2361.062H435.08 M745.471,2804.604h46.031"/>
</svg>
This diff is collapsed.
......@@ -613,12 +613,13 @@
<li><a href="#" class="demo author" data-author="huffmanCurved" data-url="Curved/huffmanTower.svg">Huffman Tower</a></li>
</ul>
</li>
<!--<li class="dropdown-submenu">-->
<!--<a tabindex="-1">Popups<span class="pull-right fui-arrow-right"></span></a>-->
<!--<ul class="dropdown-menu">-->
<li class="dropdown-submenu">
<a tabindex="-1">Popups<span class="pull-right fui-arrow-right"></span></a>
<ul class="dropdown-menu">
<li><a href="#" class="demo" data-url="Popup/geometricPopup.svg">Geometric Pattern</a></li>
<!--<li><a href="#" class="demo" data-url="Popup/popupSimple.svg">Simple Square</a></li>-->
<!--</ul>-->
<!--</li>-->
</ul>
</li>
<li class="dropdown-submenu">
<a tabindex="-1">Maze Foldings<span class="pull-right fui-arrow-right"></span></a>
<ul class="dropdown-menu">
......
......@@ -495,10 +495,16 @@ function initPattern(globals){
function processFold(fold, returnCreaseParams){
rawFold = JSON.parse(JSON.stringify(fold));//save pre-triangulated for for save later
//make 3d
for (var i=0;i<rawFold.vertices_coords.length;i++){
var vertex = rawFold.vertices_coords[i];
if (vertex.length === 2) {//make vertices_coords 3d
rawFold.vertices_coords[i] = [vertex[0], 0, vertex[1]];
}
}
var cuts = FOLD.filter.cutEdges(fold);
if (cuts.length>0) {
console.log("cut");
fold = splitCuts(fold);
fold = FOLD.convert.edges_vertices_to_vertices_vertices_unsorted(fold);
fold = removeRedundantVertices(fold, 0.01);//remove vertices that split edge
......@@ -512,7 +518,6 @@ function initPattern(globals){
var vertex = foldData.vertices_coords[i];
if (vertex.length === 2) {//make vertices_coords 3d
foldData.vertices_coords[i] = [vertex[0], 0, vertex[1]];
rawFold.vertices_coords[i] = [vertex[0], 0, vertex[1]];
}
}
......@@ -628,8 +633,18 @@ function initPattern(globals){
//check if next edge is also boundary
var nextEdgeIndex = verticesEdges[1];
if (fold.edges_assignment[nextEdgeIndex] == "B"){
groups.push([]);
groupIndex++;
//check if this edge shares a face with the next
var edge = fold.edges_vertices[edgeIndex];
var otherVertex = edge[0];
if (otherVertex == i) otherVertex = edge[1];
var nextEdge = fold.edges_vertices[nextEdgeIndex];
var nextVertex = nextEdge[0];
if (nextVertex == i) nextVertex = nextEdge[1];
if (connectedByFace(fold, fold.vertices_faces[i], otherVertex, nextVertex)){
} else {
groups.push([]);
groupIndex++;
}
}
} else if (groups[groupIndex].length>1) {
groups.push([]);
......@@ -667,11 +682,13 @@ function initPattern(globals){
var found = false;
for (var a=0;a<verticesFaces.length;a++){
var face = fold.faces_vertices[verticesFaces[a]];
if (face.indexOf(thisConnectingVertIndex) >= 0 && face.indexOf(previousConnectingVertIndex) >= 0){
var index1 = face.indexOf(thisConnectingVertIndex);
var index2 = face.indexOf(previousConnectingVertIndex);
if (index1 >= 0 && index2 >= 0 && (index1-index2 == 2 || index1-index2 == -(face.length-2))){
found = true;
var b = face.indexOf(i);
if (b<0) console.warn("problem here");
else face[b] = vertIndex
else face[b] = vertIndex;
break;
}
}
......@@ -687,6 +704,17 @@ function initPattern(globals){
return fold;
}
function connectedByFace(fold, verticesFaces, vert1, vert2){
if (vert1 == vert2) return false;
for (var a=0;a<verticesFaces.length;a++){
var face = fold.faces_vertices[verticesFaces[a]];
if (face.indexOf(vert1) >= 0 && face.indexOf(vert2) >= 0){
return true;
}
}
return false;
}
function removeBorderFaces(fold){
for (var i=fold.faces_vertices.length-1;i>=0;i--){
var face = fold.faces_vertices[i];
......@@ -705,7 +733,7 @@ function initPattern(globals){
(edge[1] == vertexIndex && edge[0] == nextVertexIndex)){
connectingEdgeFound = true;
var assignment = fold.edges_assignment[edgeIndex];
if (assignment != "B" && assignment != "C"){
if (assignment != "B"){
allBorder = false;
break;
}
......@@ -832,6 +860,7 @@ function initPattern(globals){
return false;
}
var angle = fold.edges_foldAngles[i];
if (isNaN(angle)) console.log(i);
angles.push(angle);
if (angle) {
angleAvg += angle;
......@@ -851,7 +880,8 @@ function initPattern(globals){
}
fold.edges_vertices.push([v1, v3]);
fold.edges_assignment.push(edgeAssignment);
fold.edges_foldAngles.push(angleAvg/avgSum);
if (avgSum > 0) fold.edges_foldAngles.push(angleAvg/avgSum);
else fold.edges_foldAngles.push(null);
var index = fold.vertices_vertices[v1].indexOf(v2);
fold.vertices_vertices[v1].splice(index, 1);
fold.vertices_vertices[v1].push(v3);
......
Markdown is supported
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