edu.byu.phun2d
Class Rect

java.lang.Object
  extended by edu.byu.phun2d.DrawObj
      extended by edu.byu.phun2d.Rect

public class Rect
extends DrawObj

This class will draw a rectangle based on a center point and a width and height. The rectangle will be aligned with the X and Y axes.


Constructor Summary
Rect(double centerX, double centerY, double width, double height)
          This creates a new rectangle object with the specified location and size.
 
Method Summary
 double getCenterX()
          The X coordinate of the center of the rectangle.
 double getCenterY()
          The Y coordinate of the center of the rectangle.
 double getHeight()
          The height of the rectangle.
 double getWidth()
          The width of the rectangle.
 void setCenter(double centerX, double centerY)
          Changes the center coordinates of the rectangle.
 void setHeight(double newHeight)
          Changes the height of the rectangle.
 void setWidth(double newWidth)
          Changes the width of the rectangle.
 
Methods inherited from class edu.byu.phun2d.DrawObj
getFillColor, getLineColor, getLineWidth, getRotate, getScaleX, getScaleY, getTranslate, insideToOutside, outsideToInside, setFillColor, setLineColor, setLineWidth, setRotate, setScale, setTranslate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rect

public Rect(double centerX,
            double centerY,
            double width,
            double height)
This creates a new rectangle object with the specified location and size.

Parameters:
centerX - is the X coordinate of the center of the rectangle
centerY - is the Y coordinate of the center of the rectangle
width - this is the width of the new rectangle
height - this is the height of the rectangle
Method Detail

setCenter

public void setCenter(double centerX,
                      double centerY)
Changes the center coordinates of the rectangle.

Parameters:
centerX - the new X coordinate.
centerY - the new Y coordinate.

setWidth

public void setWidth(double newWidth)
Changes the width of the rectangle.

Parameters:
newWidth - the new width.

setHeight

public void setHeight(double newHeight)
Changes the height of the rectangle.

Parameters:
newHeight - the new height.

getWidth

public double getWidth()
The width of the rectangle.

Returns:

getHeight

public double getHeight()
The height of the rectangle.

Returns:

getCenterX

public double getCenterX()
The X coordinate of the center of the rectangle.

Returns:

getCenterY

public double getCenterY()
The Y coordinate of the center of the rectangle.

Returns: