Package org.anchoranalysis.spatial.rtree
Class IntervalRTree<T>
- Type Parameters:
T
- object-type stored in structure (the payload).
An R-Tree that contains items, each with an associated one-dimensional interval.
This is similar to BoundingBoxRTree
but uses a single dimension rather than
three-dimensions to index the data.
- Author:
- Owen Feehan
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty R-Tree.IntervalRTree
(int maxNumberEntries) Creates an empty R-Tree with a specified number of children. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a bounding-box with a corresponding index.contains
(double point) Which objects contain a particular point?containsStream
(double point) intersectsWith
(double min, double max) Which bounding-boxes intersect with another specific bounding box?intersectsWithStream
(double min, double max) void
Removes a particular item from the r-tree, identified by its interval and payload.Methods inherited from class org.anchoranalysis.spatial.rtree.RTree
add, arbitraryElement, asSet, containsStream, intersectsWithStream, isEmpty, remove, size
-
Constructor Details
-
IntervalRTree
public IntervalRTree()Creates an empty R-Tree. -
IntervalRTree
public IntervalRTree(int maxNumberEntries) Creates an empty R-Tree with a specified number of children.- Parameters:
maxNumberEntries
- maximum number of entries in the r-tree
-
-
Method Details
-
add
Adds a bounding-box with a corresponding index.Note that the payload must not be unique, and multiple identical elements can exist with the same bounding-box and payload.
- Parameters:
min
- the minimum of the interval (inclusive).max
- the maximum of the interval (inclusive).payload
- the payload associated with the interval.
-
contains
Which objects contain a particular point?- Parameters:
point
- the point- Returns:
- payloads for all objects that contain
point
.
-
containsStream
- Parameters:
point
- the point- Returns:
- payloads for all objects that contain
point
.
-
intersectsWith
Which bounding-boxes intersect with another specific bounding box?- Parameters:
min
- the minimum of the interval (inclusive).max
- the maximum of the interval (inclusive).- Returns:
- payloads for all bounding-boxes that intersect with
toIntersectWith
.
-
intersectsWithStream
- Parameters:
min
- the minimum of the interval (inclusive).max
- the maximum of the interval (inclusive).- Returns:
- payloads for all bounding-boxes that intersect with
toIntersectWith
.
-
remove
Removes a particular item from the r-tree, identified by its interval and payload.If no entry can be found matching exactly the
box
andpayload
, no change happens to the r-tree. No error is reported.If multiple entries exist that match exactly the
box
andpayload
, then all entries are removed.If
box
exists but with a differentpayload
, behaviour is undefined. Eitherbox
is removed, or no change occurs.- Parameters:
min
- the minimum of the interval (inclusive).max
- the maximum of the interval (inclusive).payload
- the payload
-