01-08-2015, 09:28 PM
I ended up with this:
It seems to flatten the "tree" just the way I need.
Code:
walk([], Order, [], Data) -> % Data is {We,SplitPlaneNormal}
{Order,Data};
walk([], Before, [H|T], Data) ->
walk(H, Before, T, Data);
walk(A, Before, After, Data) ->
{F,L1,L2,Data0} = distribute(A, Data),
walk(L1, [F|Before], [L2|After], Data0).
It seems to flatten the "tree" just the way I need.