cs2110.collision
Class ImageBlocker

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

public class ImageBlocker
extends java.lang.Object

Convert an image into Block objects, and identifies connected components to generate "RigidBody" objects. NOTE: YOU DON'T HAVE TO (or want to!) MODIFY THIS CODE.

Author:
Doug James, March 2007.

Constructor Summary
ImageBlocker(java.lang.String fileName)
          Constructor: an imageblocker for image with name fileName.
 
Method Summary
 java.util.ArrayList<Block> getBlocks()
          Return the nonempty Blocks of the image.
 java.util.ArrayList<java.util.HashSet<Block>> getLargeConnectedComponents(double sizeCutoff)
          Return a list of the largest connected components.
static void main(java.lang.String[] args)
          Program entry point
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageBlocker

public ImageBlocker(java.lang.String fileName)
             throws java.io.IOException
Constructor: an imageblocker for image with name fileName.

Parameters:
fileName - TGA image filename (RGB, uncompressed) containing rigid image elements on a white background.
Throws:
java.io.IOException - if the Image file cannot be loaded
Method Detail

getBlocks

public java.util.ArrayList<Block> getBlocks()
Return the nonempty Blocks of the image.

Returns:
Nonempty Blocks of image.

getLargeConnectedComponents

public java.util.ArrayList<java.util.HashSet<Block>> getLargeConnectedComponents(double sizeCutoff)
Return a list of the largest connected components.

Parameters:
sizeCutoff - A fraction on [0,1] specifying the cutoff block count for the components in terms of the largest component size.
Returns:
The large connected components

main

public static void main(java.lang.String[] args)
Program entry point

Parameters:
args - Program arguments