public final class SpatialUtil extends Object
Modifier | Constructor and Description |
---|---|
private |
SpatialUtil()
Fake constructor: do not instantiate.
|
Modifier and Type | Method and Description |
---|---|
static int |
assertSameDimensionality(SpatialComparable box1,
SpatialComparable box2)
Check that two spatial objects have the same dimensionality.
|
static double[] |
centroid(SpatialComparable obj)
Returns the centroid of this SpatialComparable.
|
static boolean |
contains(SpatialComparable box,
double[] point)
Returns true if this SpatialComparable contains the given point, false
otherwise.
|
static boolean |
contains(SpatialComparable box1,
SpatialComparable box2)
Returns true if the first SpatialComparable contains the second
SpatialComparable, false otherwise.
|
static double |
enlargement(SpatialComparable exist,
SpatialComparable addit)
Compute the enlargement obtained by adding an object to an existing object.
|
static double |
enlargementScaled(SpatialComparable exist,
SpatialComparable addit,
double scale)
Compute the enlargement obtained by adding an object to an existing object.
|
static boolean |
equals(SpatialComparable box1,
SpatialComparable box2)
Test two SpatialComparables for equality.
|
static double[] |
getMax(SpatialComparable box)
Returns a clone of the maximum hyper point.
|
static double[] |
getMin(SpatialComparable box)
Returns a clone of the minimum hyper point.
|
static ModifiableHyperBoundingBox |
intersection(SpatialComparable box1,
SpatialComparable box2)
Calculate the intersection of the two MBRs or
null if they do
not intersect. |
static boolean |
intersects(SpatialComparable box1,
SpatialComparable box2)
Returns true if the two SpatialComparables intersect, false otherwise.
|
static double |
overlap(SpatialComparable box1,
SpatialComparable box2)
Computes the volume of the overlapping box between two SpatialComparables.
|
static double |
perimeter(SpatialComparable box)
Computes the perimeter of this SpatialComparable.
|
static double |
relativeOverlap(SpatialComparable box1,
SpatialComparable box2)
Computes the volume of the overlapping box between two SpatialComparables
and return the relation between the volume of the overlapping box and the
volume of both SpatialComparable.
|
static ModifiableHyperBoundingBox |
union(SpatialComparable box1,
SpatialComparable box2)
Computes the union HyperBoundingBox of two SpatialComparables.
|
static <E extends SpatialComparable,A> |
unionFlatMBR(A data,
ArrayAdapter<E,? super A> getter)
Compute the union of a number of objects as a flat MBR (low-level, for
index structures).
|
static ModifiableHyperBoundingBox |
unionTolerant(SpatialComparable mbr1,
SpatialComparable mbr2)
Returns the union of the two specified MBRs.
|
static double |
volume(SpatialComparable box)
Computes the volume of this SpatialComparable.
|
static double |
volumeScaled(SpatialComparable box,
double scale)
Computes the volume of this SpatialComparable.
|
static double |
volumeUnion(SpatialComparable box1,
SpatialComparable box2)
Compute the volume (area) of the union of two MBRs.
|
static double |
volumeUnionScaled(SpatialComparable box1,
SpatialComparable box2,
double scale)
Compute the volume (area) of the union of two MBRs.
|
public static int assertSameDimensionality(SpatialComparable box1, SpatialComparable box2)
box1
- First objectbox2
- Second objectIllegalArgumentException
- when the dimensionalities do not agreepublic static double[] getMin(SpatialComparable box)
box
- spatial objectpublic static double[] getMax(SpatialComparable box)
box
- spatial objectpublic static boolean intersects(SpatialComparable box1, SpatialComparable box2)
box1
- the first SpatialComparablebox2
- the first SpatialComparablepublic static boolean contains(SpatialComparable box1, SpatialComparable box2)
box1
- the outer SpatialComparablebox2
- the inner SpatialComparablepublic static boolean contains(SpatialComparable box, double[] point)
box
- spatial objectpoint
- the point to be tested for containmentpublic static double volume(SpatialComparable box)
box
- Spatial objectpublic static double volumeUnion(SpatialComparable box1, SpatialComparable box2)
box1
- First objectbox2
- Second objectpublic static double volumeScaled(SpatialComparable box, double scale)
box
- Boxscale
- Scaling factorpublic static double volumeUnionScaled(SpatialComparable box1, SpatialComparable box2, double scale)
box1
- First objectbox2
- Second objectscale
- Scaling factorpublic static double enlargement(SpatialComparable exist, SpatialComparable addit)
exist
- Existing rectangleaddit
- Additional rectanglepublic static double enlargementScaled(SpatialComparable exist, SpatialComparable addit, double scale)
exist
- Existing rectangleaddit
- Additional rectanglescale
- Scaling helperpublic static double perimeter(SpatialComparable box)
box
- spatial objectpublic static double overlap(SpatialComparable box1, SpatialComparable box2)
box1
- the first SpatialComparablebox2
- the second SpatialComparablepublic static double relativeOverlap(SpatialComparable box1, SpatialComparable box2)
box1
- the first SpatialComparablebox2
- the second SpatialComparablepublic static ModifiableHyperBoundingBox union(SpatialComparable box1, SpatialComparable box2)
box1
- the first SpatialComparablebox2
- the second SpatialComparablepublic static ModifiableHyperBoundingBox unionTolerant(SpatialComparable mbr1, SpatialComparable mbr2)
mbr1
- the first MBRmbr2
- the second MBRpublic static <E extends SpatialComparable,A> double[] unionFlatMBR(A data, ArrayAdapter<E,? super A> getter)
E
- object typeA
- data value typedata
- Objectgetter
- Array adapterpublic static ModifiableHyperBoundingBox intersection(SpatialComparable box1, SpatialComparable box2)
null
if they do
not intersect. Note: if the given MBRs intersect in only one point
of any dimension, this method still returns a result!box1
- the first MBRbox2
- the second MBRpublic static double[] centroid(SpatialComparable obj)
obj
- Spatial object to processpublic static boolean equals(SpatialComparable box1, SpatialComparable box2)
box1
- First bounding boxbox2
- Second bounding boxCopyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.