public class CollisionGridUtil extends java.lang.Object implements CollisionGridAPI
Modifier and Type | Class and Description |
---|---|
protected class |
CollisionGridUtil.BucketIterator |
Modifier and Type | Field and Description |
---|---|
protected int |
above |
protected int |
below |
protected java.util.List<java.lang.Object>[][] |
buckets |
protected float |
cellSize |
protected int |
height |
protected int |
leftOf |
protected int |
rightOf |
protected int |
width |
Constructor and Description |
---|
CollisionGridUtil(float minX,
float maxX,
float minY,
float maxY,
float cellSize) |
Modifier and Type | Method and Description |
---|---|
void |
addObject(java.lang.Object object,
Vector2f loc,
float objWidth,
float objHeight)
Adds the object to every bucket that the area overlaps.
|
protected void |
addToBucket(int cellX,
int cellY,
java.lang.Object object) |
java.util.Iterator<java.lang.Object> |
getCheckIterator(Vector2f loc,
float objWidth,
float objHeight)
Returns an iterator for all the objects in this grid that are in the specified area.
|
protected void |
removeFromBucket(int cellX,
int cellY,
java.lang.Object object) |
void |
removeObject(java.lang.Object object,
Vector2f loc,
float objWidth,
float objHeight)
Removes the object from every bucket that the area overlaps.
|
protected float cellSize
protected java.util.List<java.lang.Object>[][] buckets
protected int width
protected int height
protected int leftOf
protected int rightOf
protected int below
protected int above
public CollisionGridUtil(float minX, float maxX, float minY, float maxY, float cellSize)
public void addObject(java.lang.Object object, Vector2f loc, float objWidth, float objHeight)
CollisionGridAPI
addObject
in interface CollisionGridAPI
public void removeObject(java.lang.Object object, Vector2f loc, float objWidth, float objHeight)
CollisionGridAPI
removeObject
in interface CollisionGridAPI
protected void addToBucket(int cellX, int cellY, java.lang.Object object)
protected void removeFromBucket(int cellX, int cellY, java.lang.Object object)
public java.util.Iterator<java.lang.Object> getCheckIterator(Vector2f loc, float objWidth, float objHeight)
CollisionGridAPI
getCheckIterator
in interface CollisionGridAPI
Copyright © 2013 Fractal Softworks, LLC. All Rights Reserved.