Package com.prineside.tdi2.utils
Class AABBCounter
java.lang.Object
com.prineside.tdi2.utils.AABBCounter
Lightweight AABB which only counts entities per cell
Does not store entities
Up to 127 entities per cell
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(float x, float y, float size) voidbake()booleanentriesExistInRect(float minX, float minY, float maxX, float maxY) floatshortgetCols()intgetEntityCount(float x, float y) In a squareintgetEntityCount(int cellIdx) floatgetMaxX()floatgetMaxY()floatgetMinX()floatgetMinY()shortgetRows()booleanlineCanHitEntry(float x1, float y1, float x2, float y2) static voidvoidreset()
-
Constructor Details
-
AABBCounter
public AABBCounter(float cellSize)
-
-
Method Details
-
main
-
getMinX
public float getMinX() -
getMaxX
public float getMaxX() -
getMinY
public float getMinY() -
getMaxY
public float getMaxY() -
getCellSize
public float getCellSize() -
getCols
public short getCols() -
getRows
public short getRows() -
reset
public void reset() -
add
public void add(float x, float y, float size) -
bake
public void bake() -
getEntityCount
public int getEntityCount(int cellIdx) -
getEntityCount
public int getEntityCount(float x, float y) In a square -
entriesExistInRect
public boolean entriesExistInRect(float minX, float minY, float maxX, float maxY) -
lineCanHitEntry
public boolean lineCanHitEntry(float x1, float y1, float x2, float y2)
-