cs2110.collision
Class Shape

java.lang.Object
  extended by cs2110.collision.Shape

public class Shape
extends java.lang.Object

An instance is a collection of blocks.


Constructor Summary
Shape(java.util.HashSet<Block> blocks)
          Constructor: An instance containing blocks.
 
Method Summary
 void clear()
          "Clear" the shape from displacement and turned on flags.
 void click()
          Toggle the clickedOn flag.
 boolean contains(Vector2D p)
          Return true iff this shape contains point p.
 void createBufferedImage()
          Store in field bi a BufferedImage containing all the blocks in this Shape.
 void displace(Vector2D v)
          (Further) displace this shape by displacement vector v.
 void paint(java.awt.Graphics g, double scale)
          Paint using g, using scale to scale the image.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shape

public Shape(java.util.HashSet<Block> blocks)
Constructor: An instance containing blocks.

Parameters:
blocks - A collection of blocks.
Method Detail

createBufferedImage

public void createBufferedImage()
Store in field bi a BufferedImage containing all the blocks in this Shape.


clear

public void clear()
"Clear" the shape from displacement and turned on flags.


displace

public void displace(Vector2D v)
(Further) displace this shape by displacement vector v.

Parameters:
v - Displacement v.

paint

public void paint(java.awt.Graphics g,
                  double scale)
Paint using g, using scale to scale the image.

Parameters:
g - A Graphics2D object.
scale - The scale from image coordinates to canvas coordinates.

click

public void click()
Toggle the clickedOn flag.


contains

public boolean contains(Vector2D p)
Return true iff this shape contains point p.

Parameters:
p - A point.
Returns:
True iff this shape contains the point p.