Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
foldData.edges_vertices.push([edge[0], edge[1]]);
foldData.edges_assignment.push("U");
foldData.edges_foldAngles.push(null);
});
_.each(_cutsRaw, function(edge){
foldData.edges_vertices.push([edge[0], edge[1]]);
foldData.edges_assignment.push("C");
foldData.edges_foldAngles.push(null);
});
if (foldData.vertices_coords.length == 0 || foldData.edges_vertices.length == 0){
globals.warn("No valid geometry found in SVG, be sure to ungroup all and remove all clipping masks.");
return false;
}
foldData = FOLD.filter.collapseNearbyVertices(foldData, globals.vertTol);
foldData = FOLD.filter.removeLoopEdges(foldData);//remove edges that points to same vertex
foldData = FOLD.filter.removeDuplicateEdges_vertices(foldData);//remove duplicate edges
// foldData = FOLD.filter.subdivideCrossingEdges_vertices(foldData, globals.vertTol);//find intersections and add vertices/edges
foldData = findIntersections(foldData, globals.vertTol);
//cleanup after intersection operation
foldData = FOLD.filter.collapseNearbyVertices(foldData, globals.vertTol);
foldData = FOLD.filter.removeLoopEdges(foldData);//remove edges that points to same vertex
foldData = FOLD.filter.removeDuplicateEdges_vertices(foldData);//remove duplicate edges
foldData = FOLD.convert.edges_vertices_to_vertices_vertices_unsorted(foldData);
foldData = removeStrayVertices(foldData);//delete stray anchors
foldData = removeRedundantVertices(foldData, 0.01);//remove vertices that split edge
foldData.vertices_vertices = FOLD.convert.sort_vertices_vertices(foldData);
foldData = FOLD.convert.vertices_vertices_to_faces_vertices(foldData);
globals.warn("No valid geometry found in SVG, be sure to ungroup all and remove all clipping masks.");
return false;
}
foldData = FOLD.filter.collapseNearbyVertices(foldData, globals.vertTol);
foldData = FOLD.filter.removeLoopEdges(foldData);//remove edges that points to same vertex
foldData = FOLD.filter.removeDuplicateEdges_vertices(foldData);//remove duplicate edges
// foldData = FOLD.filter.subdivideCrossingEdges_vertices(foldData, globals.vertTol);//find intersections and add vertices/edges
foldData = findIntersections(foldData, globals.vertTol);
//cleanup after intersection operation
foldData = FOLD.filter.collapseNearbyVertices(foldData, globals.vertTol);
foldData = FOLD.filter.removeLoopEdges(foldData);//remove edges that points to same vertex
foldData = FOLD.filter.removeDuplicateEdges_vertices(foldData);//remove duplicate edges
foldData = FOLD.convert.edges_vertices_to_vertices_vertices_unsorted(foldData);
foldData = removeStrayVertices(foldData);//delete stray anchors
foldData = removeRedundantVertices(foldData, 0.01);//remove vertices that split edge
foldData.vertices_vertices = FOLD.convert.sort_vertices_vertices(foldData);
foldData = FOLD.convert.vertices_vertices_to_faces_vertices(foldData);
foldData = edgesVerticesToVerticesEdges(foldData);
foldData = removeBorderFaces(foldData);//expose holes surrounded by all border edges
foldData = reverseFaceOrder(foldData);//set faces to counter clockwise
return processFold(foldData);
}
if (!fold.vertices_vertices) {
console.warn("compute vertices_vertices first");
fold = FOLD.convert.edges_vertices_to_vertices_vertices_unsorted(fold);
}
var numStrays = 0;
var old2new = [];
var newIndex = 0;
for (var i=0;i
function processFold(fold, returnCreaseParams){
rawFold = JSON.parse(JSON.stringify(fold));//save pre-triangulated for for save later
//make 3d
for (var i=0;i0) {
fold = splitCuts(fold);
fold = FOLD.convert.edges_vertices_to_vertices_vertices_unsorted(fold);
fold = removeRedundantVertices(fold, 0.01);//remove vertices that split edge
}
delete fold.vertices_vertices;
delete fold.vertices_edges;
foldData = triangulatePolys(fold, true);
for (var i=0;i
delete fold.vertices_vertices;
delete fold.vertices_edges;
foldData = triangulatePolys(fold, true);
for (var i=0;i
function processFold(fold, returnCreaseParams){
rawFold = JSON.parse(JSON.stringify(fold));//save pre-triangulated for for save later
//make 3d
for (var i=0;i0) {
fold = splitCuts(fold);
fold = FOLD.convert.edges_vertices_to_vertices_vertices_unsorted(fold);
fold = removeRedundantVertices(fold, 0.01);//remove vertices that split edge
}
delete fold.vertices_vertices;
delete fold.vertices_edges;
foldData = triangulatePolys(fold, true);
for (var i=0;i