QuadTree<T extends Hitbox<T> > class
QuadTree calculation class not bound to Flame. Could be used anywhere outside of Flame, for example in isolates to calculate background logic.
Usage:
- Create new instance.
- Use add to add hitboxes to simulation.
- Use query to get list of hitboxes that potentially collide.
- Use remove to remove a hitbox from the tree.
- Use sequence of remove and add to simulate hitbox movement.
- Use hasMoved to determine if a hitbox ever changed its position.
- Call clear to remove all data.
Use optimize to scan the tree and remove unused quadrants.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
hitboxes
→ List<
T> -
no setter
- mainBoxSize ↔ Rect
-
getter/setter pair
- maxDepth → int
-
final
- maxObjects → int
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
T hitbox) → void -
clear(
) → void -
hasMoved(
T hitbox) → bool -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
optimize(
) → void -
query(
T value) → Map< int, List< T> > -
remove(
T hitbox, {bool keepOldPosition = false}) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited