nanome.util.octree module

class Octree(world_size=5000, max_per_node=8)[source]

Bases: object

Tree containing inserted objects and their positions.
Commonly used to get neighboring objects.
add(data, position)[source]
Add a data node to the octree.
Parameters:
  • data (object) – Data node to add to the octree
  • position – Position of this data node
get_near(pos, radius, max_result_nb=None)[source]
Get nodes within the octree neighboring a position.
Parameters:
  • pos (Vector3) – Position to check around
  • radius (float) – Radius around position where nodes within will be returned
  • max_result_nb (int) – Maximum number of neighbors to return
get_near_append(pos, radius, out_list, max_result_nb=None)[source]
Functions like get_near, but with an externally controlled list.
Parameters:
  • pos (Vector3) – Position to check around
  • radius (float) – Radius around position where nodes within will be returned
  • out_list (list) – Parent-scoped list to append search neighbors to
  • max_result_nb (int) – Maximum number of neighbors to return
move(data, new_position)[source]
Move a data node in the octree.
Parameters:
  • data (object) – Data node in the octree to move
  • new_position – New position for the data node
print_out()[source]
Prints out information about the octree.
remove(data)[source]
Remove a data node from the Octree.
Parameters:data (object) – The data to remove from the Octree