com.triangularpixels.rebirth.geometry2d
Class IntRectangle

java.lang.Object
  extended by com.triangularpixels.rebirth.geometry2d.IntRectangle

public class IntRectangle
extends Object

A 2d, axis-aligned rectangle with integer precision.


Constructor Summary
IntRectangle()
           
IntRectangle(int width, int height)
           
IntRectangle(int x, int y, int width, int height)
           
IntRectangle(IntRectangle other)
           
 
Method Summary
 int area()
           
 int bottom()
           
 boolean equals(Object rhs)
           
 int getHeight()
           
 int getWidth()
           
 int getX()
           
 int getY()
           
 boolean intersects(IntRectangle other)
          Test to see if two rectangles intersect.
 int left()
           
 int right()
           
 void setHeight(int height)
           
 void setWidth(int width)
           
 void setX(int x)
           
 void setY(int y)
           
 int top()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntRectangle

public IntRectangle()

IntRectangle

public IntRectangle(int width,
                    int height)

IntRectangle

public IntRectangle(int x,
                    int y,
                    int width,
                    int height)

IntRectangle

public IntRectangle(IntRectangle other)
Method Detail

getX

public int getX()

getY

public int getY()

getWidth

public int getWidth()

getHeight

public int getHeight()

left

public int left()

right

public int right()

bottom

public int bottom()

top

public int top()

setX

public void setX(int x)

setY

public void setY(int y)

setWidth

public void setWidth(int width)

setHeight

public void setHeight(int height)

intersects

public boolean intersects(IntRectangle other)
Test to see if two rectangles intersect. For integer rectangles, two rectangles are counted as intersecting if they share an edge (e.g. a rectangle from 0->10 on the x axis intersects a rectangle from 10->20)


area

public int area()

equals

public boolean equals(Object rhs)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 TriangularPixels.com. All Rights Reserved.