edu.byu.phun2d
Class Arc

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

public class Arc
extends DrawObj

This objec will draw an elliptical arc. If the arc has a fill color (setFillColor()) it will be drawn as a pie shape. If it has no fill color then just the curved edge is drawn.

An arc is a portion of an ellipse and the ellipse is specified by a bounding arc's ellipse as in Oval. To define the arc a starting angle is specified along with the extent of the arc angle.


Constructor Summary
Arc(double centerX, double centerY, double width, double height, double startAngle, double angle)
          This creates a new Arc with the specified parameters.
 
Method Summary
 double getCenterX()
          The X coordinate of the center of the arc's ellipse.
 double getCenterY()
          The Y coordinate of the center of the arc's ellipse.
 double getHeight()
          The height of the arc's ellipse.
 double getWidth()
          The width of the arc's ellipse.
 void setAngle(double newAngle)
          Changes the angular width of the arc.
 void setCenter(double centerX, double centerY)
          Changes the center coordinates of the arc.
 void setHeight(double newHeight)
          Changes the height of the ellipse that defines this arc.
 void setStart(double newStart)
          Changes the starting angle for the arc.
 void setWidth(double newWidth)
          Changes the width of the ellipse that defines this arc.
 
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

Arc

public Arc(double centerX,
           double centerY,
           double width,
           double height,
           double startAngle,
           double angle)
This creates a new Arc with the specified parameters. If there is a fill color (setFillColor()) then a pie shape is draw, otherwise just the curved edge is drawn.

Parameters:
centerX - the X coordinate of the center of the ellipse from which this arc is derived.
centerY - the Y coordinate of the center of the ellipse from which this arc is derived.
width - the width of the ellipse
height - the height of the ellipse.
startAngle - this is the angle at which the arc should start. This angle is measure in degrees counterclockwise starting at the positive X axis.
angle - this is the angular width of the arc. This is measured in degrees counterclockwise.
Method Detail

setCenter

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

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

setWidth

public void setWidth(double newWidth)
Changes the width of the ellipse that defines this arc.

Parameters:
newWidth - the new width.

setHeight

public void setHeight(double newHeight)
Changes the height of the ellipse that defines this arc.

Parameters:
newHeight - the new height.

setStart

public void setStart(double newStart)
Changes the starting angle for the arc.

Parameters:
newStart - the new starting angle, measured in degrees counterclockwise from the positive X axis.

setAngle

public void setAngle(double newAngle)
Changes the angular width of the arc.

Parameters:
newAngle - the new angle for the arc, measured in degrees counterclockwise.

getWidth

public double getWidth()
The width of the arc's ellipse.

Returns:

getHeight

public double getHeight()
The height of the arc's ellipse.

Returns:

getCenterX

public double getCenterX()
The X coordinate of the center of the arc's ellipse.

Returns:

getCenterY

public double getCenterY()
The Y coordinate of the center of the arc's ellipse.

Returns: