public class Quad<T extends Positionable> extends Rectangle implements PositionChangeListener<T>
Modifier and Type | Field and Description |
---|---|
protected Quad<T> |
bottomLeft |
protected Quad<T> |
bottomRight |
static com.badlogic.gdx.graphics.Color |
ELEMENT_COLOR |
protected int |
elementLimitPerQuad |
protected java.util.List<T> |
elements |
protected Quad<T> |
parent |
static com.badlogic.gdx.graphics.Color |
QUAD_COLOR |
protected Quad<T> |
topLeft |
protected Quad<T> |
topRight |
Constructor and Description |
---|
Quad(int elementLimitPerQuad,
float x,
float y,
float width,
float height) |
Quad(Quad<T> parent,
float x,
float y,
float width,
float height) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T element) |
protected boolean |
addElement(T element) |
protected boolean |
addElementToChild(T element) |
int |
getElementLimitPerQuad() |
java.util.List<T> |
getElements() |
void |
getElementsIntersectingLineSegment(java.util.Collection<T> result,
LineSegment lineSegment) |
java.util.List<T> |
getElementsIntersectingLineSegment(LineSegment lineSegment) |
void |
getElementsWithinRegion(java.util.Collection<T> result,
Parallelogram parallelogram) |
java.util.List<T> |
getElementsWithinRegion(Parallelogram parallelogram) |
Quad<T> |
getParent() |
int |
getTotalQuads() |
void |
positionChanged(T moved) |
boolean |
remove(T element) |
protected boolean |
removeElement(T element) |
protected boolean |
removeElementFromChild(T element) |
void |
render(Graphics g) |
protected void |
subdivide() |
contains, contains, contains, contains, contains, debug, draw, getCenterX, getCenterY, getDistanceTo, getDistanceTo, getMaxX, getMaxY, getMinX, getMinY, getNumberOfSides, getRotation, intersection, intersects, intersects, intersects, intersects, lerp, overlaps, rotate, rotateAround, set, set, set, setHeight, setPosition, setPosition, setRotation, setRotationAround, setSize, setSize, setWidth, setX, setY, toString
area, equals, fitInside, fitOutside, getAspectRatio, getCenter, getHeight, getPosition, getSize, getWidth, getX, getY, hashCode, merge, merge, merge, merge, perimeter, setCenter, setCenter
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getHeight, getWidth
public static com.badlogic.gdx.graphics.Color QUAD_COLOR
public static com.badlogic.gdx.graphics.Color ELEMENT_COLOR
protected Quad<T extends Positionable> parent
protected Quad<T extends Positionable> topLeft
protected Quad<T extends Positionable> topRight
protected Quad<T extends Positionable> bottomLeft
protected Quad<T extends Positionable> bottomRight
protected java.util.List<T extends Positionable> elements
protected int elementLimitPerQuad
public Quad(int elementLimitPerQuad, float x, float y, float width, float height)
public void render(Graphics g)
public boolean add(T element)
protected boolean addElement(T element)
protected boolean addElementToChild(T element)
protected void subdivide()
public boolean remove(T element)
protected boolean removeElementFromChild(T element)
protected boolean removeElement(T element)
public java.util.List<T> getElementsWithinRegion(Parallelogram parallelogram)
public void getElementsWithinRegion(java.util.Collection<T> result, Parallelogram parallelogram)
public java.util.List<T> getElementsIntersectingLineSegment(LineSegment lineSegment)
public void getElementsIntersectingLineSegment(java.util.Collection<T> result, LineSegment lineSegment)
public java.util.List<T> getElements()
public int getTotalQuads()
public void positionChanged(T moved)
positionChanged
in interface PositionChangeListener<T extends Positionable>
public int getElementLimitPerQuad()