org.caida.otter
Class BoundingBox

java.lang.Object
  |
  +--org.caida.otter.BoundingBox

public class BoundingBox
extends java.lang.Object

A class representing a bounding box with explicit coordinates.


Constructor Summary
BoundingBox(int x1, int y1, int x2, int y2)
          Create a bounding box with these boundaries
 
Method Summary
 void debug()
           
 boolean doesLineCrossBoundingBox(int x1, int y1, int x2, int y2)
          Test the provided line segment for intersection with this bounding box.
 int getBottom()
          Get the bottom boundary
 int getLeft()
          Get the left boundary
 int getRight()
          Get the right boundary
 int getTop()
          Get the top boundary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoundingBox

public BoundingBox(int x1,
                   int y1,
                   int x2,
                   int y2)
Create a bounding box with these boundaries
Parameters:
x1 - The first x val generally describing the left of the box.
y1 - The first y val generally describing the bottom of the box.
x2 - The second x val generally describing the right of the box.
y2 - The secind y val generally describing the top of the box.
Method Detail

doesLineCrossBoundingBox

public boolean doesLineCrossBoundingBox(int x1,
                                        int y1,
                                        int x2,
                                        int y2)
Test the provided line segment for intersection with this bounding box. The parameters list two points describing a line segement such that a given line segment goes from point (x1,y1) to (x2,y2).
Returns:
true if the line intersects this bounding box, false otherwise.

getTop

public int getTop()
Get the top boundary
Returns:
The top of the box (y2)

getLeft

public int getLeft()
Get the left boundary
Returns:
The left of the box (x1)

getBottom

public int getBottom()
Get the bottom boundary
Returns:
The bottom of the box (y1)

getRight

public int getRight()
Get the right boundary
Returns:
The right of the box (x2)

debug

public void debug()