[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. :)
@david2036 жыл бұрын
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.
@bibekpandey92777 жыл бұрын
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.
@kebekbutcher4 жыл бұрын
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!
@rapramos56877 жыл бұрын
wow you earned a new subscriber! thanks for providing the source code
@Xeronimo748 жыл бұрын
Excellent one again! Especially also the tips and tricks at the end :D
@tanmanhnguyen59328 жыл бұрын
Love the content man. Keep up the good work
@veecel8 жыл бұрын
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.
@p1nesap8 жыл бұрын
Neat. Would be cool if you'd do a black hole demo. In the news lately.
@shinymetalexcess8 жыл бұрын
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 Жыл бұрын
Beautiful.
@1732ashish6 жыл бұрын
can you please share some resources for coloring techniques
@ashikmahmud23438 жыл бұрын
sir ,will u plz make some tutorial about graph programming in javascrpt ?????
@ritikasharma-tf6kd5 жыл бұрын
Sir which circle packing algorithm are you using?
@balgruufthegreater90728 жыл бұрын
Really simple, really cool
@Rabb1T937 жыл бұрын
hello how can i count the number of circles?
@DaddyChronic7 жыл бұрын
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;