|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcs2110.collision.Shape
public class Shape
A shape is a collection of blocks.
Field Summary | |
---|---|
(package private) boolean |
overlaps
A flag indicating whether this shape overlaps with some other shape. |
(package private) BlockTree |
tree
A hierarchical tree structure for the blocks of the shape. |
Constructor Summary | |
---|---|
Shape(HashSet<Block> blocks)
|
Method Summary | |
---|---|
(package private) boolean |
betterOverlaps(Shape t)
Better implementation of overlap detection. |
void |
clear()
"Clear" the shape from displacement and turned on flags. |
void |
click()
Toggle the clickedOn flag. |
boolean |
contains(cs2110.collision.Vector2D p)
|
void |
displace(cs2110.collision.Vector2D v)
(Further) displace this shape by displacement vector v. |
(package private) cs2110.collision.BoundingBox |
getAbsBBox()
|
(package private) cs2110.collision.Vector2D |
getCenter()
|
(package private) boolean |
naiveOverlaps(Shape t)
Naive implementation of overlap detection. |
(package private) boolean |
overlaps(Shape t)
|
(package private) boolean |
overlapsOffscreen(double width,
double height)
|
void |
paint(Graphics g,
double scale)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
boolean overlaps
BlockTree tree
Constructor Detail |
---|
public Shape(HashSet<Block> blocks)
blocks
- A collection of blocks.Method Detail |
---|
cs2110.collision.Vector2D getCenter()
cs2110.collision.BoundingBox getAbsBBox()
boolean overlapsOffscreen(double width, double height)
width
- The width of canvas (in image coordinates)height
- The height of canvas (in image coordinates)
boolean overlaps(Shape t)
t
- A shape.
boolean naiveOverlaps(Shape t)
t
- A shape.
boolean betterOverlaps(Shape t)
t
- A shape.
public void clear()
public void displace(cs2110.collision.Vector2D v)
v
- Displacement v.public void paint(Graphics g, double scale)
g
- A Graphics2D object.scale
- The scale from image coordinates to canvas coordinates.public void click()
public boolean contains(cs2110.collision.Vector2D p)
p
- A point.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |