-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hi!
While writing a test suite for your software (can share if you want) I have found a case where 2 3D boxes do not intersect but are reported by the .batch_query
method. Reproducible example:
(ve_pqrtree_bugreport) matteo@pingu$ python
Python 3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import python_prtree
>>> A = np.array([[72.47410062, 80.52848893, 54.68197159, 75.02750896, 85.40646976, 62.42859506]])
>>> test_prtree3D = python_prtree.PRTree3D(np.array([0]), A)
>>> B = np.array([[75.02751435, 74.65699325, 61.09751679, 78.71358218, 82.4585436,67.24904609]])
>>>
>>> A[0][3] < B[0][0] # the single boxes in A and B are disjoint in x dim.
True
>>> B[0][0] - A[0][3] # small, but nothing crazy
5.389999998328676e-06
>>> test_prtree3D.batch_query(B)
[[0]]
>>> def boxes_intersect(A, B):
"""Return True if A and B intersect in 3D."""
assert len(A) == len(B)
assert len(A) % 2 == 0
D = len(A) // 2
for i in range(D):
A_min = A[i]
A_max = A[i + D]
B_min = B[i]
B_max = B[i + D]
if A_min > B_max or B_min > A_max:
return False
return True
...
>>> boxes_intersect(A[0],B[0])
False
pip freeze results:
(ve_pqrtree_bugreport) matteo@pingu$ pip freeze
numpy==1.26.4
python_prtree==0.6.1
Very best wishes,
Matteo Lacki
Metadata
Metadata
Assignees
Labels
No labels