first basic version of the bintree sprite layout algorithm