blue.shapes
Class Circle

java.lang.Object
  |
  +--blue.shapes.Circle
Direct Known Subclasses:
GeoCircle

public class Circle
extends java.lang.Object
implements Shape

A 'circle' is modeled in terms of its radius, a real number.


Constructor Summary
Circle(double r)
          Create a circle.
 
Method Summary
 double area()
          Returns the area of this circle.
 Polygon circumscribingPolygon(int d)
          Return the regular polygon of degree equal to the given int which has the property that the midpoints of its sides each touch this circle.
 Square circumscribingSquare()
          Return the square which has the property that the midpoints of its sides each touch this circle.
 void describe()
          Write a description of this circle to the standard output file.
 void describe(OutStream os)
          Write a description of this circle to the given OutStream.
 void describe(java.io.PrintStream ps)
          Write a description of this circle to the given PrintStream.
 double diameter()
          Returns the diameter of this circle.
 void expand(double a)
          Expand this circle by augmenting its radius by the given number.
 Polygon inscribingPolygon(int d)
          Return the regular polygon of degree equal to the given int which has the property that its corners touch this circle.
 Square inscribingSquare()
          Return the square which has the property that its corners touch the circle.
 double perimeter()
          Returns the circumference of this circle.
 double radius()
          Returns the radius of this circle.
 void resize(double s)
          Set the radius of the circle to the given number
 void shrink(double a)
          Shrink this circle by diminishing its radius by the given number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Circle

public Circle(double r)
Create a circle.
Parameters:
r - the radius of the circle
Method Detail

radius

public double radius()
Returns the radius of this circle.

diameter

public double diameter()
Returns the diameter of this circle.

area

public double area()
Returns the area of this circle.
Specified by:
area in interface Shape

perimeter

public double perimeter()
Returns the circumference of this circle.

describe

public void describe()
Write a description of this circle to the standard output file.
Specified by:
describe in interface Shape

describe

public void describe(java.io.PrintStream ps)
Write a description of this circle to the given PrintStream.
Specified by:
describe in interface Shape
Parameters:
ps - the stream to which the description is written

describe

public void describe(OutStream os)
Write a description of this circle to the given OutStream.
Specified by:
describe in interface Shape
Parameters:
os - the stream to which the description is written

expand

public void expand(double a)
Expand this circle by augmenting its radius by the given number.
Parameters:
a - amount by which the circle is expanded

shrink

public void shrink(double a)
Shrink this circle by diminishing its radius by the given number.
Parameters:
a - amount by which the circle is contracted

resize

public void resize(double s)
Set the radius of the circle to the given number
Parameters:
a - size, in terms of radius, to which the circle is set

circumscribingSquare

public Square circumscribingSquare()
Return the square which has the property that the midpoints of its sides each touch this circle.

inscribingSquare

public Square inscribingSquare()
Return the square which has the property that its corners touch the circle.

circumscribingPolygon

public Polygon circumscribingPolygon(int d)
Return the regular polygon of degree equal to the given int which has the property that the midpoints of its sides each touch this circle.
Parameters:
d - number of sides of the new polygon

inscribingPolygon

public Polygon inscribingPolygon(int d)
Return the regular polygon of degree equal to the given int which has the property that its corners touch this circle.
Parameters:
d - number of sides of the new polygon