*
* SECOND STAGE:
*
- * We split nodes: every node which has (only) edges which are part
- * of the same segment is split into one node for each position and
- * direction (directions are end0-to-side0+end1-to-side1 and
- * end0-to-side1+end1-to-side0), to which the corresponding edges
- * are connected. Any resulting node which has only one edge is
- * removed together with the edge.
+ * We remove stub moveable edges: whenever, at a node which has only
+ * edges which are part of the same segment, we find an edge on one
+ * side in which is not matched exactly (moveable feature settings
+ * and direction) by an edge on the other side, we delete that extra
+ * edge:
*
- * For example, when we start with:
+ * is split into one node
+ * for each position and direction (directions are
+ * end0-to-side0+end1-to-side1 and end0-to-side1+end1-to-side0), to
+ * which the corresponding edges are connected. Any resulting node
+ * which has only one edge is removed together with the edge.
*
- * ,---A1/P0J0---.
- * ...*----A1/P0J1----*---A1/P0J1---*...
- * `---A1/P1J0---' `--A1/P1J1--'
- * `--A1/P1J1--'
+ * For example (neglecting direction for the purposes of the
+ * example), when we start with:
*
- * the middle node is split like this (neglecting directions for
- * clarity):
+ * ,---A1/P0J0---.
+ * ...*----A1/P0J1----*---A1/P0J1---*...
+ * `---A1/P1J0---' `--A1/P1J1--'
+ * `--A1/P1J1--'
*
- * ,---A1/P0J0----*
- * ...*----A1/P0J1----*---A1/P0J1---*...
- * `---A1/P1J0----* /
- * `--A1/P1J1----*---A1/P1J1-'
+ * the edges A1/P0J0 and A1/P1J1 are not matched on the RHS of the node,
+ * so they are removed:
*
- * and then the stub edges and nodes are removed, leaving this:
+ * ...*----A1/P0J1----*---A1/P0J1---*...
+ * `---A1/P1J0---' `--A1/P1J1--'
*
- * ...*----A1/P0J1----*---A1/P0J1---*...
- * \ /
- * `--A1/P1J1----*---A1/P1J1-'
*
- * The actual implementation of the second stage simply considers
- * whether to create each node as it goes along, rather than
- * inventing nodes merely to delete them.
+ * THIRD STAGE:
+ *
+ * We split nodes: every node which has only edges which are part of
+ * the same segment is split into one node for each kind of edge
+ * which goes through it. The 2nd stage ensures that this is always
+ * straightforward.
+ *
+ * Our example above turns into:
+ *
+ * ...*----A1/P0J1----*---A1/P0J1---*...
+ * `---A1/P1J0----*---A1/P1J1--'
*/
static void movfeatmultedges(void) {
continue;
}
trace(" yes:\n");
+ rightedge->edge->pname=
+ masprintf("%s+%s", leftedge->edge->pname, rightedge->edge->pname);
rightedge->edge->distance += leftedge->edge->distance;
edgeend_replumb(rightedge, edgeend_otherend(leftedge)->node);
edge_delete(leftedge->edge);