|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcs2110.collision.Block
public class Block
An instance is a square block/pixel primitive for representing image-based rigid objects and resolving contacts. Each Block is wrapped by a disk and used for contact generation.
Method Summary | |
---|---|
boolean |
contains(Vector2D p)
Return true iff this block contains point p |
void |
display(java.awt.Graphics g,
double scale,
Vector2D d,
boolean clicked,
boolean overlaps)
Draw this block using g, which must be a Graphics2D object. |
BoundingBox |
getBBox()
Return the bounding box of this block. |
int |
getCol()
Return the Image column. |
double |
getColorMass()
Return the color-based mass on [0,1] with white having 0 mass and darker colors approaching 1 (feel free to modify). |
double |
getHalfwidth()
Return the halfwidth of block. |
javax.vecmath.Point2d |
getPosition()
Return the center position of Block (in body coordinates). |
int |
getRow()
Return the Image row. |
static boolean |
overlaps(Block b,
Vector2D u,
Block c,
Vector2D v)
Return true iff block b displaced by u overlaps block c displaced by v |
java.lang.String |
toString()
Return a representation of this Block. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static boolean overlaps(Block b, Vector2D u, Block c, Vector2D v)
b
- A block.u
- Displacement vector for block a.c
- A block.v
- Displacement vector for block b.
public boolean contains(Vector2D p)
public void display(java.awt.Graphics g, double scale, Vector2D d, boolean clicked, boolean overlaps)
g
- A Graphics2D object.scale
- Scale factor from image coordinate system to canvas coordinate
system.d
- Displacement vector for the block.clicked
- Indicates whether the shape containing the block has been
clicked on.overlaps
- Indicates whether the shape containing the block overlaps
another shape.public BoundingBox getBBox()
public double getColorMass()
public double getHalfwidth()
public javax.vecmath.Point2d getPosition()
public java.lang.String toString()
toString
in class java.lang.Object
public int getCol()
public int getRow()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |