MENU

Fun & Interesting

Coding Challenge #98.1: Quadtree - Part 1

The Coding Train 325,959 lượt xem 7 years ago
Video Not Working? Fix It Now

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 2: https://youtu.be/QQx_NmCIuCY
📺 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 Introducing today's topic: Quadtrees
1:34 N squared problem
4:30 Big O notation
8:23 QuadTree class
11:15 Capacity
12:26 Insert points
13:30 Create a subdivide function
20:11 Recursively add points
21:12 Check if point is within boundary
26:49 Visualize the Quadtree
30:30 Use mouse clicks to add points
32:43 Edge cases

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

Comment