Code down for build octree function