public class Block
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected double |
halfwidth |
protected javax.vecmath.Point2d |
position
Body-frame position --- needed for contact processing.
|
Modifier and Type | Method and Description |
---|---|
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 this 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.
|
protected double halfwidth
protected javax.vecmath.Point2d position
public static boolean overlaps(Block b, Vector2D u, Block c, Vector2D v)
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()