Coding Math: Episode 53 - Random Circle Packing

Поділитися
Вставка
  • Опубліковано 3 січ 2025

КОМЕНТАРІ • 24

  • @bibekpandey9277
    @bibekpandey9277 7 років тому +1

    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!

  • @identifinity333
    @identifinity333 7 років тому +1

    [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 років тому +1

    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.

  • @rapramos5687
    @rapramos5687 7 років тому +3

    wow you earned a new subscriber! thanks for providing the source code

  • @Xeronimo74
    @Xeronimo74 8 років тому +2

    Excellent one again! Especially also the tips and tricks at the end :D

  • @p1nesap
    @p1nesap 8 років тому +1

    Neat. Would be cool if you'd do a black hole demo. In the news lately.

  • @tanmanhnguyen5932
    @tanmanhnguyen5932 8 років тому +1

    Love the content man. Keep up the good work

  • @veecel
    @veecel 8 років тому +1

    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.

  • @shinymetalexcess
    @shinymetalexcess 8 років тому +1

    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.

  • @1732ashish
    @1732ashish 6 років тому

    can you please share some resources for coloring techniques

  • @ritikasharma-tf6kd
    @ritikasharma-tf6kd 5 років тому

    Sir which circle packing algorithm are you using?

  • @getfun4353
    @getfun4353 8 років тому

    what's the code editor you are using

  • @Rabb1T93
    @Rabb1T93 7 років тому

    hello how can i count the number of circles?

    • @DaddyChronic
      @DaddyChronic 7 років тому +2

      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;

  • @philtoa334
    @philtoa334 Рік тому

    Beautiful.

  • @ashikmahmud2343
    @ashikmahmud2343 8 років тому

    sir ,will u plz make some tutorial about graph programming in javascrpt ?????

  • @balgruufthegreater9072
    @balgruufthegreater9072 8 років тому

    Really simple, really cool

  • @yashaswiification
    @yashaswiification 8 років тому

    really good one

  • @cythb1
    @cythb1 4 роки тому

    nice job!

  • @jdskale
    @jdskale 8 років тому

    Wonderful