some quick helper functions we will need for ball trees