implementing QBVH