Class Point2DList

java.lang.Object
  extended by Point2DList

public class Point2DList
extends java.lang.Object

Maintains an open locus of Point2D objects intended to be manipulated by Transform2D objects

Author:
C. D'Arcy

Constructor Summary
Point2DList()
          Only constructor leaves the instance field as an empty ArrayList of points
 
Method Summary
 void addPoint(Point2D p)
          Modifier method appends a Point2D object onto the end of the ArrayList of Point2D objects
 void applyTransform(Transform2D transform)
          Modifier method applies the Transform2D matrix supplied by the parameter to each of the Point2D objects maintained in the ArrayList.
 void createPolygon(int n, double r)
          Modifier methods clears the ArrayList and adds the Point2D objects representing the vertices of a regular n-gon of 'radius' r centered at the origin.
 void createUnitSquare()
          Modifier methods clears the ArrayList and adds the Point2D objects (0,0), (1,0), (1,1), and (0,1)
 java.util.ArrayList<Point2D> getPoints()
          Accessor method called to retrieve the ArrayList<Point2D> containing the data
 java.lang.String toString()
          Returns a String developed, in part, by calling upon Point2D's toString() method
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Point2DList

public Point2DList()
Only constructor leaves the instance field as an empty ArrayList of points

Method Detail

createUnitSquare

public void createUnitSquare()
Modifier methods clears the ArrayList and adds the Point2D objects (0,0), (1,0), (1,1), and (0,1)


addPoint

public void addPoint(Point2D p)
Modifier method appends a Point2D object onto the end of the ArrayList of Point2D objects


createPolygon

public void createPolygon(int n,
                          double r)
Modifier methods clears the ArrayList and adds the Point2D objects representing the vertices of a regular n-gon of 'radius' r centered at the origin.

Parameters:
n - the number of vertices (sides) of the regular polygon
r - the 'radius' of the polygon

applyTransform

public void applyTransform(Transform2D transform)
Modifier method applies the Transform2D matrix supplied by the parameter to each of the Point2D objects maintained in the ArrayList. The method should not rewrite the code to undertake matrix multiplication, but instead make use of the public mul method available in the Matrix2D class

Parameters:
transform - the transform to be applied

getPoints

public java.util.ArrayList<Point2D> getPoints()
Accessor method called to retrieve the ArrayList<Point2D> containing the data

Returns:
the ArrayList<Point2D> containing the data

toString

public java.lang.String toString()
Returns a String developed, in part, by calling upon Point2D's toString() method

Overrides:
toString in class java.lang.Object