public interface SpatialJoinQuery<T1,T2>
A spatial join-query defining a join on one or two spatial stores.
The methods of this interface are passed the bounding boxes of the elements, as well as bounding-boxes of groups of elements, according to SpaceBase’s internal bounding-volume hierarchy.
In theory, a query can always return true
for all invocations of join
which tests the query on a pair of bounding-box of two groups of elements, and then return true
or false
accordingly on invocations to joinElements
to test each pair of element, and still function correctly. However, this would require SpaceBase to run the query on all pairs of elements would entail an O(n^2)
running time. Returning false
from join
is what allows SpaceBase to take advantage of its bounding-volume hierarchy, and perform the query in logarithmic time.
boolean join(AABB aabb1, AABB aabb2)
Called by SpaceBase to inquire whether any of the elements contained in the first given AABB
may match the join-query with any of the elements contained in the second AABB
.
aabb1
- The bounding-box of the first group of elements.aabb2
- The bounding-box of the second group of elements.true
if any of the elements within the first box may match the join-query with any of the elements in the other, false
otherwise.boolean joinElements(AABB aabb1, T1 elem1, AABB aabb2, T2 elem2)
Called by SpaceBase to inquire whether two elements with the given bounding-boxes match the join-query.
aabb1
- The first element’s bounding-box.elem1
- The first element.aabb2
- The second element’s bounding-box.elem2
- The second element.true
if the two elements match the join query, or false
if they don’t.