com.partnersoft.geometry
Class Rectangle

java.lang.Object
  extended by com.partnersoft.geometry.Rectangle
All Implemented Interfaces:
Coggable

public class Rectangle
extends java.lang.Object
implements Coggable


Field Summary
 double height
           
 double width
           
 double x
           
 double y
           
 
Constructor Summary
Rectangle()
           
Rectangle(Cog state)
           
Rectangle(double x, double y, double width, double height)
           
Rectangle(XyBounds bounds)
           
 
Method Summary
 boolean contains(double x, double y)
           
 Rectangle copy()
           
 boolean covers(Rectangle nother)
          Returns true if this rectangle covers the given one.
 boolean equals(java.lang.Object nother)
           
 double getArea()
           
 Point getCenter()
           
 double getHeight()
           
 double getMaxX()
           
 double getMaxY()
           
 double getMinX()
           
 double getMinY()
           
 double getWidth()
           
 double getX()
           
 double getY()
           
 boolean intersects(Rectangle nother)
          Returns true if the given rectangle intersects this one.
 void setHeight(double argHeight)
           
 void setWidth(double argWidth)
           
 void setX(double argX)
           
 void setY(double argY)
           
 void stretchToInclude(double newX, double newY)
           
 void stretchToInclude(Rectangle nother)
           
 Cog toCog()
          Returns the complete internal state of this object in the form of a Cog.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x

y

public double y

width

public double width

height

public double height
Constructor Detail

Rectangle

public Rectangle()

Rectangle

public Rectangle(double x,
                 double y,
                 double width,
                 double height)

Rectangle

public Rectangle(XyBounds bounds)

Rectangle

public Rectangle(Cog state)
Method Detail

contains

public boolean contains(double x,
                        double y)

toCog

public Cog toCog()
Description copied from interface: Coggable
Returns the complete internal state of this object in the form of a Cog.

Specified by:
toCog in interface Coggable
Returns:
Cog representing the internal state of this object

getX

public double getX()

setX

public void setX(double argX)

getY

public double getY()

setY

public void setY(double argY)

getWidth

public double getWidth()

setWidth

public void setWidth(double argWidth)

getHeight

public double getHeight()

setHeight

public void setHeight(double argHeight)

getArea

public double getArea()

getMaxX

public double getMaxX()

getMaxY

public double getMaxY()

getMinX

public double getMinX()

getMinY

public double getMinY()

intersects

public boolean intersects(Rectangle nother)
Returns true if the given rectangle intersects this one.


covers

public boolean covers(Rectangle nother)
Returns true if this rectangle covers the given one.


stretchToInclude

public void stretchToInclude(double newX,
                             double newY)

stretchToInclude

public void stretchToInclude(Rectangle nother)

equals

public boolean equals(java.lang.Object nother)
Overrides:
equals in class java.lang.Object

getCenter

public Point getCenter()

copy

public Rectangle copy()

toString

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