I believe something like this should do it:
I see it necessary to have the option of saving the tree and loading it to/from a text file, so it can be used with different versions of a model. upon loading, simply traverse the tree and if a face is missing just cut the rest of the branch.
to simplify the computation of the position of each face added to the tree, it may be advantageous to have a secondary list of fold (connecting) edges their X-Y position and orientation on the plane. when creating a tree and/or branch, a new sheet (page) with custom dimensions MAY be added for that branch and displayed alongside the 3D model ; the user should be able to move around and rotate each branch in the sheet in order to optimize placement simultaneously while building up the tree.
Code:
face_clicked()
is it connected to two or more faces present in the tree?
{
// connect where?
request from user: EDGE = select_edge() or FACE = select_face()
}
if is_set(EDGE) {
FACE = from the connected faces, find which one connects to face_clicked() with that EDGE ; make sure it doesn't crash if no face match (invalid edge clicked, FACE not in tree)
}
if FACE not in tree: try again (or make new group)
is it connected to another face present in the tree?
{
- what edge connects the two faces? (unless EDGE is set)
- compute position and add to tree ; output can be generated on-the-fly
- update face color and edge colors ; color faces by first-level branch (group) and edges by unset/cut/fold
} else {
- make new group
}
I see it necessary to have the option of saving the tree and loading it to/from a text file, so it can be used with different versions of a model. upon loading, simply traverse the tree and if a face is missing just cut the rest of the branch.
to simplify the computation of the position of each face added to the tree, it may be advantageous to have a secondary list of fold (connecting) edges their X-Y position and orientation on the plane. when creating a tree and/or branch, a new sheet (page) with custom dimensions MAY be added for that branch and displayed alongside the 3D model ; the user should be able to move around and rotate each branch in the sheet in order to optimize placement simultaneously while building up the tree.