p5.js Coding Tutorial | Quadtree 🌴 (how not to crash your program w +1,000 colliding particles!) @pattvira
p5.js Coding Tutorial | Quadtree 🌴 (how not to crash your program w +1,000 colliding particles!)  @pattvira
Uploaded August 2024 | Updated November 2026, 2 days ago
LET'S CONNECT
✨ Sign up for my newsletter at pattvira.com
✨ Instagram: instagram.com/pattvira
✨ Twitter: twitter.com/pattvira
--
Links:
πŸ”— p5.js editor: editor.p5js.org
πŸ”— Quadtree (Part 1 of 2) Code: editor.p5js.org/pattvira/sketches/ga_GjOZps
πŸ”— Introduction to Creative Coding Playlist: youtube.com/playlist?list=PL0beHPVMklwgMz4Z-mNp4_udo9mjBk7pn&si=XhvQaojd6cIrxvdn

What to watch next!
πŸ”— Quadtree - Flocking Simulation (Part 2 of 2): youtu.be/AMugNCfP1NA

References:
πŸ”— Inspiration - Chris Barber's Adrift: instagram.com/p/C-QHx2ASmWx
πŸ”— OpenFrameworks - Creative coding tool in C++ used to make Adrift: openframeworks.cc
πŸ”— @TheCodingTrain 's Quadtree Series:
πŸ”— Part 1: youtube.com/watch?v=OJxEcs0w_kE
πŸ”— Part 2: youtube.com/watch?v=QQx_NmCIuCY
πŸ”— Part 3: youtube.com/watch?v=z0YFFg_nBjw&t=169s
πŸ”— Collision Detection: youtu.be/gUTeWOfwECc

Timestamps:
0:00 Intro
0:10 Inspiration for the tutorial
1:06 Agenda
1:49 What is a quadtree?
3:19 Let's start coding
3:58 Create a Point class to represent a simple coordinate (x, y)
4:19 Create a Rect class for a rectangular bounding box
4:58 Create a Quadtree class with 3 main methods (insert, subdivide, and query)
6:29 Write an Insert method
14:08 Write a Subdivide method
23:02 Write a Query method
30:02 Fix a bug
32:41 Create a Circle class for a circular bounding box
40:52 Create a Particle class
47:37 Call collision detection without a quadtree (oh no!)
50:53 Call collision detection with a quadtree (oh yes!)
57:42 Moment of truth
p5.js Coding Tutorial | Quadtree 🌴 (how not to crash your program w +1,000 colliding particles!)p5.js Coding Tutorial | Rotating Type (Kinetic Typography)p5.js Coding Tutorial | Rose-shaped Spiral 🌹How I learned web dev using AI as a learning partnerp5.js Coding Tutorial | A Shattered Heart πŸ’” (with matter.js)p5.js Coding Tutorial | Music Visualization with FFT 🎡p5.js Coding Tutorial | Oscillating Wave Pattern (in 3D)p5.js Coding Tutorial |  Tic Tac Toep5.js Coding Tutorial | Intro to OpenType.js (Kinetic Typography)p5.js Coding Tutorial | Truchet Tilesp5.js Coding Tutorial | Text Distortionp5.js Coding Tutorial | Flocking Simulation with Quadtree 🐀🐀🐀
Patt Vira |

p5.js Coding Tutorial | Quadtree 🌴 (how not to crash your program w +1,000 colliding particles!)

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER