cs5643.rigidbody
Class ImageBlocker

java.lang.Object
  extended by cs5643.rigidbody.ImageBlocker

public class ImageBlocker
extends java.lang.Object

Converts 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.


Nested Class Summary
(package private)  class ImageBlocker.ScanlineCCBuilder
          Finds connected components by unifying row/column fragment labels via iterative minimization of row/col fragment labels using expansion moves.
 
Field Summary
(package private)  Block[][] B
          Block[i][j] with null for massless/background Blocks.
(package private)  java.util.ArrayList<java.util.HashSet<Block>> components
          Resulting sets of connected Block components.
(package private)  com.sun.opengl.util.texture.spi.TGAImage image
          Image in question.
(package private)  int M
          #Rows
(package private)  int N
          #Columns
 
Constructor Summary
ImageBlocker(java.lang.String tgaFilename)
           
 
Method Summary
 void addComponentRigidBodies(RigidBodySystem R)
          Constructs new RigidBody objects for each connected component of Blocks, and adds each to the RigidBodySystem.
 java.util.ArrayList<Block> getBlocks()
          Nonempty Blocks of image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

image

com.sun.opengl.util.texture.spi.TGAImage image
Image in question.


M

int M
#Rows


N

int N
#Columns


B

Block[][] B
Block[i][j] with null for massless/background Blocks.


components

java.util.ArrayList<java.util.HashSet<Block>> components
Resulting sets of connected Block components.

Constructor Detail

ImageBlocker

public ImageBlocker(java.lang.String tgaFilename)
             throws java.io.IOException
Parameters:
tgaFilename - TGA image filename (RGB, uncompressed) containing rigid image elements on a white background.
Throws:
java.io.IOException
Method Detail

getBlocks

public java.util.ArrayList<Block> getBlocks()
Nonempty Blocks of image.


addComponentRigidBodies

public void addComponentRigidBodies(RigidBodySystem R)
Constructs new RigidBody objects for each connected component of Blocks, and adds each to the RigidBodySystem.