I have a finite set P
of several thousands of sparse points in the 3d space and a moving sphere S
of fixed radius. For every given moment t
I know S_t
, i.e. the volume of space occupied by the sphere. I don't know beforehand in which direction S
is going to move next. How can I find the subset Q_t
of all the points contained in S_t
?
I thought to do as follows:
- Put all the points in an R-tree and compute
Q_0
For every t > 0, compute the relative complements
N_t = S_t \ S_(t-1)
andM_t = S_(t-1) \ S_t
- Then, I query the R-tree for all the points contained in the relative complements,
P(N_t)
andP(M_t)
Finally, I update the result as:
Q_t = Q_(t-1) + P(N_t) - P(M_t)
Does this work? Is there a more efficient way to compute this?
Also, are there any libraries that allow me to efficiently solve this?