Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 
Share Thread:
Reddit Facebook Twitter
Trying to implement BSP - any advice? (Solved)
01-12-2015, 10:07 PM
Post: #4
RE: Trying to implement BSP - any advice? (Solved)
Turns out that this "in-place" sorting (which is in essence reverse pre-order traversal) produces adequate results only on very simple objects. I now create a linked structure instead:
Code:
branch_out(Fs, We) ->
    {_,A,We0} = distribute(Fs, We),
    branch_out(orddict:new(), [A], We0).
branch_out(Lookup, [], We) ->
    {flatten_tree(Lookup, []),We};
branch_out(Lookup, [{F,L,R}|T], We)->
    {F0,A0,We0} = distribute(L, We),
    {F1,A1,We1} = distribute(R, We0),
    branch_out(
        orddict:store(F, {F0,F1}, Lookup), [A0,A1|T], We1);
branch_out(Lookup, [_|T], We) ->
    branch_out(Lookup, T, We).

I still haven't found a suitable flattening principle though.
Reply


Messages In This Thread
RE: Trying to implement BSP - any advice? (Solved) - nemyax - 01-12-2015 10:07 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)