--- C:/BRL-CAD/BRL-CAD GCI/voxelize/voxelizeOriginal.c ne 1 15 19:18:32 2017 +++ C:/BRL-CAD/BRL-CAD GCI/voxelize/newVoxelize.c ne 1 15 19:18:28 2017 @@ -31,0 +32 @@ +#include "bu/list.h" @@ -91,0 +93,19 @@ create_boxes(void *callBackData, int x, int y, int +struct bu_list * +BalanceTree(struct bu_list* stack, float count) +{ + struct bu_list* l = stack; + if(stack->forw != BU_LIST_NULL && count >= 1) { + l->forw = BalanceTree(stack->forw, count / 2); + stack = stack->forw; + } + else l->forw = BU_LIST_NULL; //count is for tree end detection + + if(stack->forw != BU_LIST_NULL && count >= 1) { + l->back = BalanceTree(stack->forw, count / 2); + stack = stack->forw; + } + else l->back = BU_LIST_NULL; + + return l; +} + @@ -211,0 +232,2 @@ ged_voxelize(struct ged *gedp, int argc, const cha + + BalanceTree(&voxDat.content.l, bu_list_len(&voxDat.content.l));