xxl.spatial
Class Rectangle

java.lang.Object
  |
  +--xxl.spatial.Rectangle

public class Rectangle
extends java.lang.Object
implements Tree.Descriptor, Convertable


Field Summary
protected  double[] leftBorders
           
protected  double[] rightBorders
           
 
Constructor Summary
Rectangle(double[] leftBorders, double[] rightBorders)
           
Rectangle(int dim)
           
Rectangle(Rectangle interval)
           
Rectangle(Tree.Descriptor rectangle)
           
 
Method Summary
 double area()
           
 double[] borders(boolean right)
           
 java.lang.Object clone()
           
 boolean contains(double[] point)
           
 boolean contains(Rectangle interval)
           
 boolean contains(Tree.Descriptor descriptor)
           
 double[] deltas()
           
 int dimensions()
           
 double distance(Rectangle interval, int p)
          Computes the shortest distance between this rectangle and the given interval using the Lp-Metrics.
 boolean equals(java.lang.Object object)
           
 void intersect(Rectangle interval)
           
 double margin()
           
 double maxDistance(double[] point, int p)
          Computes the distance between the given point and the most distant point of this rectangle using the Lp-Metrics.
 double minDistance(double[] point, int p)
          Computes the distance between the given point and the nearest point of this rectangle using the Lp-Metrics.
 double overlap(Rectangle interval)
           
 boolean overlaps(Rectangle interval)
           
 boolean overlaps(Tree.Descriptor descriptor)
           
 void read(java.io.DataInput dataInput)
           
static Rectangle readSingletonRectangle(java.io.File file, int dim)
           
 int sizeOf()
           
 java.lang.String toString()
           
 Rectangle union(Rectangle interval)
           
 Tree.Descriptor union(Tree.Descriptor descriptor)
           
 int write(java.io.DataOutput dataOutput)
           
static void writeSingletonRectangle(java.io.File file, Rectangle interval)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

leftBorders

protected double[] leftBorders

rightBorders

protected double[] rightBorders
Constructor Detail

Rectangle

public Rectangle(double[] leftBorders,
                 double[] rightBorders)

Rectangle

public Rectangle(Rectangle interval)

Rectangle

public Rectangle(Tree.Descriptor rectangle)

Rectangle

public Rectangle(int dim)
Method Detail

clone

public java.lang.Object clone()
Specified by:
clone in interface Tree.Descriptor
Overrides:
clone in class java.lang.Object

read

public void read(java.io.DataInput dataInput)
          throws java.io.IOException
Specified by:
read in interface Convertable

readSingletonRectangle

public static Rectangle readSingletonRectangle(java.io.File file,
                                               int dim)

writeSingletonRectangle

public static void writeSingletonRectangle(java.io.File file,
                                           Rectangle interval)

write

public int write(java.io.DataOutput dataOutput)
          throws java.io.IOException
Specified by:
write in interface Convertable

sizeOf

public int sizeOf()
Specified by:
sizeOf in interface Convertable

dimensions

public int dimensions()

borders

public double[] borders(boolean right)

deltas

public double[] deltas()

area

public double area()

margin

public double margin()

contains

public boolean contains(double[] point)

contains

public boolean contains(Rectangle interval)

contains

public boolean contains(Tree.Descriptor descriptor)
Specified by:
contains in interface Tree.Descriptor

equals

public boolean equals(java.lang.Object object)
Specified by:
equals in interface Tree.Descriptor
Overrides:
equals in class java.lang.Object

overlaps

public boolean overlaps(Rectangle interval)

overlaps

public boolean overlaps(Tree.Descriptor descriptor)
Specified by:
overlaps in interface Tree.Descriptor

overlap

public double overlap(Rectangle interval)

minDistance

public double minDistance(double[] point,
                          int p)
Computes the distance between the given point and the nearest point of this rectangle using the Lp-Metrics.

maxDistance

public double maxDistance(double[] point,
                          int p)
Computes the distance between the given point and the most distant point of this rectangle using the Lp-Metrics.

distance

public double distance(Rectangle interval,
                       int p)
Computes the shortest distance between this rectangle and the given interval using the Lp-Metrics.

union

public Rectangle union(Rectangle interval)

union

public Tree.Descriptor union(Tree.Descriptor descriptor)
Specified by:
union in interface Tree.Descriptor

intersect

public void intersect(Rectangle interval)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object