|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--tjhBuckets
a simple regular space-partitioning class to speed up collision detection
| Field Summary | |
protected float |
bucket_scale
the width of each bucket |
protected tjhBucket[][] |
buckets
the 2D array of tjhBucket's |
protected int |
n_xBuckets
the number of buckets in each direction |
protected int |
n_yBuckets
the number of buckets in each direction |
| Constructor Summary | |
tjhBuckets(float scale,
int n_x,
int n_y)
default constructor initializes bucket array |
|
| Method Summary | |
protected int |
BCoord(float coord)
returns the floor of the coord divided by the width of each bucket - the index on one axis of the bucket containing it |
boolean |
CollidesWithAny(tjh2dVector loc,
float dist)
would a tjhCell at the specified location be overlapping any existing one? |
protected tjhBucket |
FindBucket(tjh2dVector pos)
locate the bucket that contains the specified coordinate (x or y) |
java.util.Vector |
GetAllWithin(tjh2dVector loc,
float dist)
get a list of the collisions that would be caused (empty if none) |
void |
PutCell(tjhCell cell)
add the bucket reference for this cell (newly created or just moved) |
void |
RemoveCell(tjhCell cell)
remove the bucket reference for this cell (died or about to move) |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected tjhBucket[][] buckets
protected float bucket_scale
protected int n_xBuckets
protected int n_yBuckets
| Constructor Detail |
public tjhBuckets(float scale,
int n_x,
int n_y)
| Method Detail |
public void RemoveCell(tjhCell cell)
public void PutCell(tjhCell cell)
public java.util.Vector GetAllWithin(tjh2dVector loc,
float dist)
public boolean CollidesWithAny(tjh2dVector loc,
float dist)
protected tjhBucket FindBucket(tjh2dVector pos)
protected int BCoord(float coord)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||