Coding Math: Episode 53 - Random Circle Packing

  Рет қаралды 14,974

Coding Math

Coding Math

Күн бұрын

Пікірлер
@identifinity333
@identifinity333 7 жыл бұрын
[Check if radius is greater than 0 -> if yes: go further, if not: reset random coordinates and restore max radius -> Check overlaping with max allowed radius -> if valid: draw, if not valid: decrease radius by 1] --> loop everything in the brackets Idk how much is it efficient but it will mostly get rid of blank spaces. :)
@david203
@david203 6 жыл бұрын
Neither this video nor the comments on it have mentioned the obvious and largest slowdown (inefficiency) caused by comparing the new circle with all the other circles (which is an order n operation) to see if there is overlap. Since one is generating n circles, this exhaustive comparison creates an order n-squared complexity measure for the entire program, which is slow. One easy way to speed this up to an "n log n" complexity is to test for overlap by storing two indices (arrays) into the array of circles, one giving their x center location and the other for y. Then, check for overlap by doing a binary search (of complexity log n) in the x dimension and another in the y dimension. The complexity of the program is now 2*n*log(n), which in complexity theory is the same order of magnitude as n*log(n). This is a fast speedup. Also, note that you don't have to take the square root (of the sum of squares) to find the true distance. An overlap test can simply use the square of the new circle's radius. Why? Because the square of the distance works just as well as the distance itself to determine overlap. Even faster collision/overlap detection can be done by doing a rough calculation using squares instead of circles, then doing the circle vector distance calculation only when the squares are close to each other.
@bibekpandey9277
@bibekpandey9277 7 жыл бұрын
Thank you so much!! I hadn't thought that randomness would create this beautiful piece!! Had been pondering about creating tightly packed circles since long!! Thanks again.
@kebekbutcher
@kebekbutcher 4 жыл бұрын
Java is about to expire... None the less, he is using the Pi number for randomness where there cannot be an absolute random... but he did good!
@rapramos5687
@rapramos5687 7 жыл бұрын
wow you earned a new subscriber! thanks for providing the source code
@Xeronimo74
@Xeronimo74 8 жыл бұрын
Excellent one again! Especially also the tips and tricks at the end :D
@tanmanhnguyen5932
@tanmanhnguyen5932 8 жыл бұрын
Love the content man. Keep up the good work
@veecel
@veecel 8 жыл бұрын
Super! Thanks for keeping it simple and straightforward with Javascript. I'm going to explore circle packing and post a fun animated piece soon. I'll send you a link via Twitter.
@p1nesap
@p1nesap 8 жыл бұрын
Neat. Would be cool if you'd do a black hole demo. In the news lately.
@shinymetalexcess
@shinymetalexcess 8 жыл бұрын
Just stumbled on your work, and perusing through them. But wanted to put in a request for a tutorial on quaternions as I'm tackling an forward kinematic system in 3d.
@philtoa334
@philtoa334 Жыл бұрын
Beautiful.
@1732ashish
@1732ashish 6 жыл бұрын
can you please share some resources for coloring techniques
@ashikmahmud2343
@ashikmahmud2343 8 жыл бұрын
sir ,will u plz make some tutorial about graph programming in javascrpt ?????
@ritikasharma-tf6kd
@ritikasharma-tf6kd 5 жыл бұрын
Sir which circle packing algorithm are you using?
@balgruufthegreater9072
@balgruufthegreater9072 8 жыл бұрын
Really simple, really cool
@Rabb1T93
@Rabb1T93 7 жыл бұрын
hello how can i count the number of circles?
@DaddyChronic
@DaddyChronic 7 жыл бұрын
each circle is stored in the array circles. you can count them by using the length property of the array. like this: var countCircles = circles.length;
@yashaswiification
@yashaswiification 8 жыл бұрын
really good one
@cythb1
@cythb1 4 жыл бұрын
nice job!
@getfun4353
@getfun4353 8 жыл бұрын
what's the code editor you are using
@KonoganCossec
@KonoganCossec 8 жыл бұрын
Online jsbin.com
@codingmath
@codingmath 8 жыл бұрын
yup
@jdskale
@jdskale 8 жыл бұрын
Wonderful
Coding Math: Episode 54 - Dot Product
11:13
Coding Math
Рет қаралды 14 М.
Studying Apollonian Circle Packings using Group Theory
8:05
Proof of Concept
Рет қаралды 6 М.
Air Sigma Girl #sigma
0:32
Jin and Hattie
Рет қаралды 45 МЛН
UFC 287 : Перейра VS Адесанья 2
6:02
Setanta Sports UFC
Рет қаралды 486 М.
«Жат бауыр» телехикаясы І 26-бөлім
52:18
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 434 М.
9.8: Random Circles with No Overlap - p5.js Tutorial
19:25
The Coding Train
Рет қаралды 152 М.
Coding Math: Episode 41 - Isometric 3D Part I
17:19
Coding Math
Рет қаралды 31 М.
The BEST Way to Find a Random Point in a Circle | #SoME1 #3b1b
18:35
Coding Math: Episode 47 - Weighted Random
13:00
Coding Math
Рет қаралды 23 М.
Coding Adventure: Boids
8:35
Sebastian Lague
Рет қаралды 1,6 МЛН
A simple procedural animation technique
8:31
argonaut
Рет қаралды 530 М.
I Wrote HTTP "From Scratch" (It Was Easy)
19:07
Sean Bix
Рет қаралды 89 М.
The Genius Way Computers Multiply Big Numbers
22:04
PurpleMind
Рет қаралды 211 М.
Superpositions, Sudoku, the Wave Function Collapse algorithm.
14:28
Martin Donald
Рет қаралды 708 М.
Coding Math: Episode 50 - IFS Fractals
12:21
Coding Math
Рет қаралды 17 М.