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.
[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. :)
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.
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.
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.
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;
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.
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!
[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. :)
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.
wow you earned a new subscriber! thanks for providing the source code
Excellent one again! Especially also the tips and tricks at the end :D
Neat. Would be cool if you'd do a black hole demo. In the news lately.
Love the content man. Keep up the good work
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.
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.
can you please share some resources for coloring techniques
Sir which circle packing algorithm are you using?
what's the code editor you are using
Online jsbin.com
yup
hello how can i count the number of circles?
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;
Beautiful.
sir ,will u plz make some tutorial about graph programming in javascrpt ?????
Really simple, really cool
really good one
nice job!
Wonderful