Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

XORxes-1/Quadtree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

237 Commits

Repository files navigation

Quadtree ver 3.27


Quadtree.java will efficiently determine when AABBs are in close proximity to each other with variable degrees of precision. The Quadtree and all Quadnodes are built during initialization. During runtime, the Quadtree will querry Quadnodes to see if there are at least two AABBs within the Quadnode's bounds. If at least two AABBs are found, the search will continue deeper into the sub-Quadnodes otherwise, searching will be culled for the given Quadnode. If at least two AABBs intersect a Quadnode at the deepest tree depth, those AABBs are considered as being in close proximity to each other.


Some noteworthy characteristics (in real time):

  • AABBs can be added or removed from the Quadtree
  • Quadtree can be squared or rectangulated (square shape is recommended)
  • Tree depth can be increased or decreased allowing variability in what is considered "close proximity"
  • Velocities of AABBs can be increased, decreased or averaged

Folder breakdown:

root
| LICENSE
│
├───docs
│ quadtree_ver_3.27_javadocs.zip
│
├───extras
│ CHANGE_LOG
│ LICENSE
│ (追記) ProximityTester.java (追記ここまで)
│
└───src
 (追記) AABB.java (追記ここまで)
 CHANGE_LOG
 LICENSE
 (追記) Quadnode.java (追記ここまで)
 (追記) Quadtree.java (追記ここまで)

Example Usage:

// 5 AABBs created and added to the array with various initial values.
AABB[] aabbs = new AABB[5];
for(int i=0; i<aabbs.length; i++){
 aabbs[i] = new AABB();
 aabbs[i].set_Size(150, 100);
 aabbs[i].set_Velocity((i+1)*0.3f, (i+1)*0.4f);
 aabbs[i].relocate(new Random().nextInt(850), new Random().nextInt(900));
}
// intialize width, height and tree depth
int width = 1000;
int height = 1000;
int tree_Depth = 5;
// create Quadtree using AABB array, width height and tree depth
Quadtree qtree = new Quadtree(aabbs, width, height, tree_Depth);
// relocate, resize and change velocities of AABBs as needed and then call qtree.update();

Qt simulator

Older UI for ProximityTester.java (previously "Tester.java"):

Qt simulator

About

Quadtree and AABB (Axis-Aligned Bounding Box) implementation

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /