de.lmu.ifi.dbs.elki.data.spatial
Class SpatialUtil

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.data.spatial.SpatialUtil

public final class SpatialUtil
extends Object

Utility class with spatial functions.


Constructor Summary
SpatialUtil()
           
 
Method Summary
static double[] centroid(SpatialComparable obj)
          Returns the centroid of this SpatialComparable.
static double[] centroid(SpatialComparable obj, int start, int end)
          Returns the centroid of the specified values 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 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 boolean intersects(SpatialComparable box1, SpatialComparable box2)
          Returns true if the two SpatialComparables intersect, false otherwise.
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 HyperBoundingBox union(SpatialComparable box1, SpatialComparable box2)
          Computes the union HyperBoundingBox of two SpatialComparables.
static HyperBoundingBox unionTolerant(SpatialComparable mbr1, SpatialComparable mbr2)
          Returns the union of the two specified MBRs.
static double volume(SpatialComparable box)
          Computes the volume of this SpatialComparable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpatialUtil

public SpatialUtil()
Method Detail

getMin

public static double[] getMin(SpatialComparable box)
Returns a clone of the minimum hyper point.

Returns:
the minimum hyper point

getMax

public static double[] getMax(SpatialComparable box)
Returns a clone of the maximum hyper point.

Returns:
the maximum hyper point

intersects

public static boolean intersects(SpatialComparable box1,
                                 SpatialComparable box2)
Returns true if the two SpatialComparables intersect, false otherwise.

Parameters:
box1 - the first SpatialComparable
box2 - the first SpatialComparable
Returns:
true if the SpatialComparables intersect, false otherwise

contains

public static boolean contains(SpatialComparable box1,
                               SpatialComparable box2)
Returns true if the first SpatialComparable contains the second SpatialComparable, false otherwise.

Parameters:
box1 - the outer SpatialComparable
box2 - the inner SpatialComparable
Returns:
true if the first SpatialComparable contains the second SpatialComparable, false otherwise

contains

public static boolean contains(SpatialComparable box,
                               double[] point)
Returns true if this SpatialComparable contains the given point, false otherwise.

Parameters:
point - the point to be tested for containment
Returns:
true if this SpatialComparable contains the given point, false otherwise

volume

public static double volume(SpatialComparable box)
Computes the volume of this SpatialComparable

Returns:
the volume of this SpatialComparable

perimeter

public static double perimeter(SpatialComparable box)
Computes the perimeter of this SpatialComparable.

Returns:
the perimeter of this SpatialComparable

relativeOverlap

public 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.

Parameters:
box1 - the first SpatialComparable
box2 - the second SpatialComparable
Returns:
the overlap volume in relation to the singular volumes.

union

public static HyperBoundingBox union(SpatialComparable box1,
                                     SpatialComparable box2)
Computes the union HyperBoundingBox of two SpatialComparables.

Parameters:
box1 - the first SpatialComparable
box2 - the second SpatialComparable
Returns:
the union HyperBoundingBox of this HyperBoundingBox and the given HyperBoundingBox

unionTolerant

public static HyperBoundingBox unionTolerant(SpatialComparable mbr1,
                                             SpatialComparable mbr2)
Returns the union of the two specified MBRs. Tolerant of "null" values.

Parameters:
mbr1 - the first MBR
mbr2 - the second MBR
Returns:
the union of the two specified MBRs

centroid

public static double[] centroid(SpatialComparable obj)
Returns the centroid of this SpatialComparable.

Parameters:
obj - Spatial object to process
Returns:
the centroid of this SpatialComparable

centroid

public static double[] centroid(SpatialComparable obj,
                                int start,
                                int end)
Returns the centroid of the specified values of this SpatialComparable.

Parameters:
obj - Spatial object to process
start - the start dimension to be considered
end - the end dimension to be considered
Returns:
the centroid of the specified values of this SpatialComparable

equals

public static boolean equals(SpatialComparable box1,
                             SpatialComparable box2)
Test two SpatialComparables for equality.

Parameters:
box1 - First bounding box
box2 - Second bounding box
Returns:
true when the boxes are equal

Release 0.4.0 (2011-09-20_1324)