fold
fold copied to clipboard
Spec version 1.2
- Add join edge (
"J"
) option toedges_assignment
(fix #26). - Add cut/slit edge (
"C"
) option toedges_assignment
(fix #24). - Define
vertices_edges
andfaces_faces
(mostly fix #27 --edges_edges
seems of dubious use). - Extend definition of
edges_faces
andvertices_faces
andfaces_faces
to allownull
values, allowing for consistent left/right specification. (This was already done in the code, so this makes the spec consistent with current implementation.)
Just spoke with Robby, Robert, Tachi, & Tom about the proposal for 1.2. We had consensus for all the proposed changes except two:
-
There was pushback against item (2), adding
'c'
cut edges to the spec. It seems more useful as a specification for SVG files imported into FOLD rather than something we want to support within the FOLD spec itself? Robert, Robby, and I in particular all preferred not adding shorthand for functionality that is already supported with the existing spec. Of course, we all thought that mentioning of this type of import convention might be useful in the spec documentation, and adding code in the library to make these types of conversions would be a good idea. If we do add to the FOLD spec, I think we'd want to supplement with the algorithm one could use to convert between the two formats, i.e., taking internal walks along boundary/cut edges, splitting vertices and edges along the way. -
Robby mentioned being confused on what to do with the external boundary face. The spec seems to implicitly assume that the boundary face exists (e.g., when talking about cyclic alignment between data structures like
vertices_vertices
andvertices_faces
). I think we should be explicit that we accept one or both of two conventions: (1) include boundary faces, and/or (2) usenull
in place of omitted boundary faces in such data structures, similar to the current proposal foredges_faces
.
Thanks for the feedback! Here are some responses/motivations:
'C' is for ~~cookie~~ cut
My motivation here is actually the crease pattern editor cp-editor, which lets users interactively draw crease patterns that include cuts/slits. So it's not just SVG import; it's also an active type of file that users actually want to work with. Currently cp-editor saves these files as .cp
, to avoid confusion, but they're actually FOLD files with 'C' type edges. cp-editor can also export .fold
files with the slits cut apart, but the issue is that I wouldn't know how to load those files back in for further editing... is there a clear glue-back-together algorithm? Maybe — though I'm still not sure it's a good idea to cut apart and glue back together for every save/load, as it would exacerbate any bugs in those algorithms. (The cut-apart algorithm is unfortunately buggy, currently.)
I agree that most software shouldn't want to care about 'C' type edges because it's redundant (though not too big a deal if the FOLD JavaScript library can do the cutting itself — most of the code is already there, though as I mentioned it needs some bug fixing). I do, however, feel that some crease-pattern-oriented code might prefer to work with 'C'-edge FOLD files, while others (e.g. simulators) certainly do not. I see a couple of possibilities:
- Perhaps in a non-spec document, add a list of "common extensions" that other software uses (other custom attributes). This could be helpful anyway. I'm not sure whether "C" in edge types is a valid extension, though; perhaps it would have to be relegated to a separate data structure like
edges_cpeditor:slit
? - Add 'C' to the spec but somehow make it clear that it doesn't need to be supported. Most FOLD features are this way, at least implicitly; very little software supports all the features. (For example, most software ignores frames.) Perhaps we could make it more explicit...
Boundary face
I feel strongly that the boundary face should not be included as a FOLD "face". To me, FOLD faces should correspond to material of paper, and the boundary face isn't (normally) material. Assuming everyone agrees, it sounds like we need to update vertices_vertices
and vertices_faces
to match the new definition of edges_faces
.
I have fully implemented "J" assignment in Rabbit Ear, and partially implemented "C", and have recently been working with Amanda's Origami Simulator with regards to "C". Wanted to share.
join assignment
You can see "J" in action in fold viewer. I have a shader which will outline faces without adding any additional geometry, using the barycentric wireframe approach. "F" and "U" assignments will still show up as black lines, but "J" is hidden and functions perfectly as this "invisible line".
You can load the "folded crane" example, the crane's wing is a pentagon in the FOLD file, and gets processed into three triangles with two "J" edges.
All in all, "J" is a nice addition. Easy to understand. 10/10. 5 stars.
cut assignment
Regarding "C", I want to talk about the method which resolves all cuts into boundaries, joins with other boundaries, duplicates vertices... Erik, in your last message you spoke of a method which almost works- was it this method, splitCuts from Origami simulator?
I realized recently that "C" assignments can be on a 3D FOLD object too, so I created a test file that is the Stanford bunny with a few cut lines where I placed them when I made the Stanford bunny for Origamizer.
So I started looking into splitCuts
in Ori Sim, and I did find bugs (maybe the same as you, Erik) but the method itself splitCuts
does seem to work, including with 3D models! The issue that I could identify happens in Ori Sim's file preparation which happens just before splitCuts
, it assumes the graph is 2D when it builds vertices_vertices/vertices_edges.
So I have written a method which makes a sorted vertices_vertices by walking neighboring faces, which works in 3D, and will work as long as each vertex has no more than 2 adjacent holes. I dropped it into my fork of Ori Sim and the splitCuts
method works! At least in this case. Still wondering about the errors you encountered, Erik.
If "C" is to be adopted, it would be nice to get such a method finalized and incorporated into the FOLD package; one which processes "C" into boundaries. It seems close to being done. I can offer to help. It would be nice to create a few more test FOLD files with "C" for testing, like more 3D models, cuts that make islands, cuts on a non manifold model...
Here is my Stanford bunny FOLD file with a few cut lines running up its back through its ears. It includes vertices_vertices, build by this method I spoke of earlier.
You can use fold viewer to see the Stanford bunny FOLD file. see the "C" edges by checking box "show creases".
You can load the Stanford bunny FOLD file in this fork of Origami Simulator to see splitCuts
in action. (origamisimulator.org appears to not like it).
{
"file_spec": 1.1,
"file_creator": "Rabbit Ear",
"file_title": "Stanford Bunny",
"file_author": "Kraft",
"file_classes": ["singleModel"],
"frame_classes": ["foldedForm"],
"frame_attributes": ["3D"],
"vertices_coords":[
[-4.498931,3.147773,0.181835],[-4.557349,2.082472,0.697259],[-3.07032,4.23874,1.762023],[-4.076093,0.001936,1.107375],[2.950079,0.055147,1.00281],[-1.096427,5.830371,-0.717677],[-3.10043,5.387782,-3.086266],[-1.223708,2.815631,1.220183],[0.390108,3.181022,0.185816],[-4.59804,2.288467,2.178839],[-1.62618,-0.868822,-0.503767],[-3.666046,2.271722,-0.431766],[-4.536206,4.066438,1.026011],[1.604964,1.188187,-1.01477],[-4.551212,1.175283,0.850787],[-2.612268,4.195515,0.645511],[-3.967972,3.17974,2.683493],[-3.48215,2.303492,2.657752],[-0.309384,1.009445,-1.917948],[-0.451567,5.346025,-1.469755],[2.298579,1.40475,0.79984],[2.844157,-0.726053,-0.136003],[-3.268838,3.561421,-0.457568],[0.158494,1.630549,2.274441],[-2.466235,3.663707,0.075377],[-2.957971,1.112161,2.327206],[-3.557516,1.856693,2.064218],[0.124327,-0.516452,2.85667],[2.618295,-1.359569,0.829077],[2.484568,0.28933,0.525522],[-3.179761,-1.738689,1.017074],[0.882077,-1.594115,2.132988],[1.332302,2.501323,1.580588],[-2.412865,0.196147,2.15975],[2.034804,-0.723001,1.678599],[0.732387,-1.696151,-0.493074],[-3.446745,4.104529,-2.54327],[-3.782777,-1.6673,0.026168],[-2.259767,-1.720254,-0.76965],[-2.16445,-1.034784,1.980421],[-3.291215,-1.641876,2.183311],[1.268213,0.881688,2.464054],[-2.292629,2.96786,1.140089],[-1.62214,1.243433,2.21375],[-1.29347,-0.931538,2.032796],[1.696119,2.143237,-0.295267],[-1.433818,-1.563849,2.80097],[-2.515121,-0.896432,0.796816],[-1.682867,1.188515,-1.291449],[-2.083575,-1.768751,-1.559177],[-1.057133,1.008989,2.896109],[-0.816674,4.533923,-0.349209],[-1.516611,-1.611888,2.131003],[1.889283,-0.710724,-0.436824],[-1.31993,-1.073235,-1.36827],[0.648431,-1.696023,-1.071017],[-3.876009,5.385763,-2.466716],[0.340278,-0.649736,-1.640465],[-1.412777,0.309231,-1.838236],[-2.515807,-0.599013,-0.459537],[-2.483166,2.873362,-0.305461],[-2.571918,1.588931,-1.136505],[0.473236,2.338757,-0.898994],[-3.294838,4.221361,0.222431],[1.139079,-1.658086,0.570052],[-3.869911,4.027547,-0.212799],[-3.887556,0.554465,-0.784717],[1.025244,-1.62313,1.275895]
],
"faces_vertices":[
[63,12,2],[0,12,65],[50,41,23],[41,50,27],[23,41,32],[44,31,27],[33,43,25],[25,7,26],[7,42,26],[39,43,33],[44,43,39],[43,7,25],[29,34,4],[32,8,7],[40,39,47],[7,23,32],[46,31,44],[23,7,43],[23,43,50],[21,29,4],[13,20,29],[17,42,16],[16,42,2],[52,39,40],[17,26,42],[29,20,34],[41,20,32],[5,15,51],[28,4,34],[34,20,41],[21,28,35],[51,15,24],[34,27,31],[34,41,27],[63,56,65],[38,10,49],[3,14,66],[6,63,22],[10,59,48],[31,67,34],[55,53,35],[40,47,30],[13,45,20],[13,29,53],[42,15,2],[28,21,4],[42,24,15],[12,63,65],[1,12,0],[63,2,15],[20,45,32],[1,66,14],[60,42,7],[45,8,32],[6,56,63],[44,50,43],[19,51,24],[27,50,44],[12,16,2],[45,62,8],[17,16,9],[46,39,52],[25,26,3],[5,51,19],[47,39,33],[3,26,14],[46,44,39],[6,22,36],[15,5,63],[16,12,9],[62,61,8],[36,65,56],[58,54,10],[36,22,65],[58,10,48],[62,45,13],[9,12,1],[62,48,61],[26,1,14],[30,47,37],[48,13,18],[0,65,22],[1,11,66],[47,59,37],[11,1,0],[10,54,49],[29,21,53],[63,24,22],[7,8,60],[13,48,62],[22,24,60],[60,8,61],[60,61,11],[42,60,24],[66,11,61],[0,22,11],[38,37,59],[11,22,60],[35,53,21],[53,57,13],[53,55,57],[38,59,10],[57,18,13],[24,63,19],[59,61,48],[54,57,55],[55,49,54],[19,63,5],[56,6,36],[54,58,57],[57,58,18],[66,61,59],[58,48,18],[28,64,35],[28,67,64],[28,34,67],[1,26,9],[26,17,9],[59,47,3],[3,33,25],[33,3,47],[3,66,59]
],
"edges_vertices":[
[63,12],[12,2],[2,63],[0,12],[12,65],[65,0],[50,41],[41,23],[23,50],[50,27],[27,41],[41,32],[32,23],[44,31],[31,27],[27,44],[33,43],[43,25],[25,33],[25,7],[7,26],[26,25],[7,42],[42,26],[39,43],[33,39],[44,43],[39,44],[43,7],[29,34],[34,4],[4,29],[32,8],[8,7],[7,32],[40,39],[39,47],[47,40],[7,23],[46,31],[44,46],[43,23],[43,50],[21,29],[4,21],[13,20],[20,29],[29,13],[17,42],[42,16],[16,17],[42,2],[2,16],[52,39],[40,52],[17,26],[20,34],[41,20],[20,32],[5,15],[15,51],[51,5],[28,4],[34,28],[41,34],[21,28],[28,35],[35,21],[15,24],[24,51],[34,27],[31,34],[63,56],[56,65],[65,63],[38,10],[10,49],[49,38],[3,14],[14,66],[66,3],[6,63],[63,22],[22,6],[10,59],[59,48],[48,10],[31,67],[67,34],[55,53],[53,35],[35,55],[47,30],[30,40],[13,45],[45,20],[29,53],[53,13],[42,15],[15,2],[42,24],[1,12],[0,1],[15,63],[45,32],[1,66],[14,1],[60,42],[7,60],[45,8],[6,56],[44,50],[19,51],[24,19],[12,16],[45,62],[62,8],[16,9],[9,17],[46,39],[52,46],[26,3],[3,25],[19,5],[33,47],[26,14],[22,36],[36,6],[5,63],[12,9],[62,61],[61,8],[36,65],[56,36],[58,54],[54,10],[10,58],[22,65],[48,58],[13,62],[1,9],[62,48],[48,61],[26,1],[47,37],[37,30],[48,13],[13,18],[18,48],[22,0],[1,11],[11,66],[47,59],[59,37],[0,11],[54,49],[21,53],[63,24],[24,22],[8,60],[24,60],[60,22],[61,60],[61,11],[11,60],[61,66],[22,11],[38,37],[59,38],[53,57],[57,13],[55,57],[57,18],[63,19],[59,61],[54,57],[55,54],[55,49],[58,57],[58,18],[59,66],[28,64],[64,35],[28,67],[67,64],[26,9],[47,3],[3,59],[3,33]
],
"faces_edges":[
[0,1,2],[3,4,5],[6,7,8],[6,9,10],[7,11,12],[13,14,15],[16,17,18],[19,20,21],[22,23,20],[24,16,25],[26,24,27],[28,19,17],[29,30,31],[32,33,34],[35,36,37],[38,12,34],[39,13,40],[38,28,41],[41,42,8],[43,31,44],[45,46,47],[48,49,50],[49,51,52],[53,35,54],[55,23,48],[46,56,29],[57,58,11],[59,60,61],[62,30,63],[56,57,64],[65,66,67],[60,68,69],[70,14,71],[64,10,70],[72,73,74],[75,76,77],[78,79,80],[81,82,83],[84,85,86],[87,88,71],[89,90,91],[37,92,93],[94,95,45],[47,96,97],[98,99,51],[65,44,62],[100,68,98],[0,74,4],[101,3,102],[2,99,103],[95,104,58],[105,79,106],[107,22,108],[109,32,104],[110,72,81],[111,42,26],[112,69,113],[9,111,15],[114,52,1],[115,116,109],[50,117,118],[119,53,120],[21,121,122],[61,112,123],[36,25,124],[121,125,78],[40,27,119],[83,126,127],[59,128,103],[114,129,117],[130,131,116],[132,73,133],[134,135,136],[126,137,132],[136,86,138],[115,94,139],[129,101,140],[141,142,130],[143,106,125],[92,144,145],[146,147,148],[5,137,149],[150,151,105],[152,153,144],[150,102,154],[135,155,76],[43,156,96],[157,158,82],[33,159,108],[146,141,139],[158,160,161],[159,131,162],[162,163,164],[107,160,100],[151,163,165],[149,166,154],[167,153,168],[166,161,164],[90,156,67],[169,170,97],[89,171,169],[168,84,75],[172,147,170],[157,173,113],[174,142,85],[175,171,176],[177,155,176],[173,128,123],[110,127,133],[134,178,175],[178,179,172],[165,174,180],[138,148,179],[181,182,66],[183,184,181],[63,88,183],[143,185,140],[55,118,185],[152,186,187],[188,18,122],[188,186,124],[80,180,187]
],
"edges_foldAngle":[
-10.416277713087995,-36.1439376492362,-9.80897391697791,-32.13867380859517,-52.772770206959756,-44.01270881886221,-22.473973665789742,1.9280946141776367,-38.70589451312392,-44.0855253240703,-26.00639947902405,-41.22415761569299,-16.372134296302942,93.33576787526287,-50.51728617727124,-22.038189448329064,-0.08111369736913539,-39.33601506820385,-37.96359074666908,9.48650312279928,-14.053821103391241,-60.426269850721965,-56.71116693088075,93.94812472702634,8.622852035556466,-79.28927108827327,49.87815393769754,56.698775917729584,9.900418661604247,85.41193472708215,-87.06671627653817,-89.99492693529743,-42.32279372536921,-18.91917553488679,-26.09990515039546,-63.11346787556233,74.70298061429412,-33.7507963753339,-9.2230375409354,0,-18.881953961324317,27.293307511030985,-73.10722522211118,-33.441890486584455,-57.415065311075125,2.8725371424231443,-46.978125291958015,-17.28701380447976,-58.704460527287665,16.930113686081246,-74.6750180981519,-30.609238526589085,-78.98677105883138,94.96111045129575,0,-63.216552132660034,-10.674454846670193,-9.34201167540359,-38.56645946854391,-53.19783479696492,-55.477500653611905,-31.247994104055337,-38.08992823277202,-33.0729723903708,-30.73658164503276,-54.50209875073927,-27.67156994161616,-42.86463188161604,71.43974740681246,-73.08433601932727,-2.5045703038610587,-53.96708595075553,-50.63993814890922,-76.407128211933,42.1218211900861,0,-15.479692553169963,0,-55.692446313507396,-21.455716567247798,-27.940635293106048,0,0,-21.898451703814388,38.529786778118414,-8.68659870856063,0,0,38.696969191961195,-50.21383681656759,61.09915534416652,0,33.92672295597133,0,-39.213008726295996,-36.310051749265234,53.78108084809017,-22.975572300741426,-20.931654258743954,-66.47352575853525,-14.763257048887452,-2.223302061524223,-39.6059186509318,42.5577033299132,-11.759705961767445,-22.81907929053752,-58.34142183575,78.53439678103523,20.638027358841352,-32.7940260759444,0,-28.64248772039629,0,-54.2906551018316,-37.854538276449496,-17.44797542195532,-31.15206673625094,-49.70537724579447,-35.614288286756846,-113.06193444738147,0,-9.31430579233276,-14.34391903083472,0,52.935623226514124,-15.12919697858471,-109.5201263119057,0,-86.99418395707892,-35.08251455339523,-32.55148798811413,23.122760953071037,-31.297760710341716,-40.21028972124366,-66.5090101652512,58.061278492712404,-2.737665946981363,61.67840981915247,-60.98063807072271,-31.856377954150066,-69.42495654210178,-10.899183756165035,0,73.96120716797743,-17.486805467646928,0,66.03915686626489,-76.38879893800157,-52.929861154102134,13.494164400056697,28.166964668175748,-27.161404691387357,112.58730018732683,-77.62475853987142,-30.21389856423111,-70.91680231733716,-52.4537541021278,0,-21.190978994906065,-66.75468004204586,-53.33360030258535,0,0,-22.445218998477422,41.43492610107958,-38.93835882911041,-39.24784780013625,0,-29.823439326734274,-5.704113959367156,-15.524658005224742,-38.66249806428004,-25.48897388193164,0,15.538060740790826,-10.241532054860734,35.13320935798376,0,-11.594522454955294,-40.623453840679595,-59.43468741725883,-7.073926001580548,0,-41.57280333147069,0,-30.46113358498746,-49.77463102267442,-7.034484903924037,-22.897603564265708
],
"edges_assignment":[
"M","M","M","M","M","M","M","V","M","M","M","M","M","V","M","M","M","M","M","V","M","M","M","V","V","M","V","V","V","V","M","M","M","M","M","M","V","M","M","B","M","V","M","M","M","V","M","M","M","V","M","M","M","V","B","M","M","M","M","M","M","M","M","M","M","M","M","M","V","M","M","M","M","M","V","C","M","B","M","M","M","C","C","M","V","M","C","B","V","M","V","B","V","B","M","M","V","M","M","M","M","M","M","V","M","M","M","V","V","M","C","M","C","M","M","M","M","M","M","M","B","M","M","C","V","M","M","C","M","M","M","V","M","M","M","V","M","V","M","M","M","M","C","V","M","B","V","M","M","V","V","M","V","M","M","M","M","C","M","M","M","C","C","M","V","M","M","B","M","M","M","M","M","C","V","M","V","B","M","M","M","M","B","M","B","M","M","M","M"
],
"vertices_vertices":[
[12,65,22,11,1],[12,0,11,66,14,26,9],[63,12,16,42,15],[14,66,59,47,33,25,26],[29,34,28,21],[15,51,19,63],[63,22,36,56],[26,25,43,23,32,8,60,42],[7,32,45,62,61,60],[17,16,12,1,26],[49,38,59,48,58,54],[66,1,0,22,60,61],[2,63,65,0,1,9,16],[20,29,53,57,18,48,62,45],[66,3,26,1],[51,5,63,2,42,24],[17,42,2,12,9],[42,16,9,26],[48,13,57,58],[51,24,63,5],[29,13,45,32,41,34],[29,4,28,35,53],[6,63,24,60,11,0,65,36],[50,41,32,7,43],[51,15,42,60,22,63,19],[33,43,7,26,3],[25,7,42,17,9,1,14,3],[41,50,44,31,34],[4,34,67,64,35,21],[34,4,21,53,13,20],[40,47,37],[67,34,27,44,46],[23,41,20,45,8,7],[43,25,3,47,39],[4,29,20,41,27,31,67,28],[55,53,21,28,64],[6,22,65,56],[30,47,59,38],[37,59,10,49],[43,33,47,40,52,46,44],[52,39,47,30],[23,50,27,34,20,32],[26,7,60,24,15,2,16,17],[25,33,39,44,50,23,7],[31,27,50,43,39,46],[20,13,62,8,32],[31,44,39,52],[40,39,33,3,59,37,30],[10,59,61,62,13,18,58],[38,10,54,55],[41,23,43,44,27],[5,15,24,19],[46,39,40],[35,55,57,13,29,21],[10,58,57,55,49],[49,54,57,53,35],[65,63,6,36],[13,53,55,54,58,18],[54,10,48,18,57],[48,10,38,37,47,3,66,61],[42,7,8,61,11,22,24],[8,62,48,59,66,11,60],[8,45,13,48,61],[12,2,15,5,19,24,22,6,56,65],[35,28,67],[0,12,63,56,36,22],[3,14,1,11,61,59],[64,28,34,31]
]
}
Talking with Jason, a possible replacement for "C" would be:
- Mark these edges as "B" (generalizing "B")
- Remove assumption that boundary edges have degree 1
But this would be a breaking change in behavior for "B". It would also be difficult (but maybe still possible) to distinguish true boundary vs. cuts for files with edges and vertices (and edges_assignment
) but no faces. And it may be useful to be able to have a function that labels edges accordingly, and "C" would be nice to have as such a label. So maybe we leave "C" as is.
In any case, we should add a frame_attributes
of cuts
or slits
or internalBoundaries
that indicates that "C"s (or cut "B" edges) exist. Maybe hasCuts
and hasJoins
? Also useful would be a convexFaces
attribute (one of the goals of "J" edges).
We should also document and improve filter_cutEdges
to remove "C"s (or cut "B" edges). Maybe a CLI option too? And ideally write a corresponding "weld" function to put duplicate boundary edges back together (as needed in cp-editor).