Coding Challenge #98.2: Quadtree - Part 2
In this multi-part coding challenge, I implement a Quadtree data structure in JavaScript and visualize it with p5.js. Code: https://thecodingtrain.com/challenges/98-quadtree
p5.js Web Editor Sketches:
πΉοΈ Quadtree Parts 1 & 2: https://editor.p5js.org/codingtrain/sketches/g7LnWQ42x
πΉοΈ Quadtree - Part 3: https://editor.p5js.org/codingtrain/sketches/CDMjU0GIK
Other Parts of this Challenge:
πΊ Quadtree - Part 1: https://youtu.be/OJxEcs0w_kE
πΊ Quadtree - Part 3: https://youtu.be/z0YFFg_nBjw
π₯ Next video: https://youtu.be/KtPpoMThKUs?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
References:
πΎ Quadtree repo: https://github.com/CodingTrain/QuadTree
π Quadtree on Wikipedia: https://en.wikipedia.org/wiki/Quadtree
Live Stream Archive:
π΄ Quadtree Live Stream: https://youtu.be/MxnqJGwu2cc
Related Coding Challenges:
π #65 Binary Tree: https://youtu.be/ZNH0MuQ51m4
π #68 Breadth-First Search: https://youtu.be/piBq7VD0ZSo
π #72 Frogger: https://youtu.be/giXV6xErw0Y
Timestamps:
0:00 Quadtree Part 2--query the data structure for points contained within a rectangular boundary
1:45 Write a query function to get all the points within a rectangle
3:16 Write an intersection function
6:14 Create an array of "found" points
13:00 Draw points within the rectangle
15:21 Sanity check--how many points are being counted
16:57 Adjust the rectangle with the mouse
18:44 Return the points array
19:42 Up next: apply the quadtrees algorithm to a collision detection problem
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
π Website: http://thecodingtrain.com/
πΎ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
π© Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
π‘ GitHub: https://github.com/CodingTrain
π¬ Discord: https://discord.gg/hPuGy2g
π Membership: http://youtube.com/thecodingtrain/join
π Store: https://standard.tv/codingtrain
ποΈ Twitter: https://twitter.com/thecodingtrain
πΈ Instagram: https://www.instagram.com/the.coding.train/
π₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA
π p5.js: https://p5js.org
π p5.js Web Editor: https://editor.p5js.org/
π Processing: https://processing.org
π Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct
This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new
#quadtreedatastructure #quadtreecollisiondetection #javascript #p5js