Coding Challenge 182: Apollonian Gasket Fractal

  Рет қаралды 84,434

The Coding Train

The Coding Train

Күн бұрын

Пікірлер: 153
@SimpleCarGuy
@SimpleCarGuy 6 ай бұрын
I started watching this video thinking, ‘oh that makes sense’ and then progressively got to a point where I was just thinking, ‘well, as long as he knows what’s happening!’ Great video!
@olli3686
@olli3686 6 ай бұрын
This is crazy. This is the 4th video in a row where you’re working on something that I’ve been working on 😂. My intention was to combine my weighted voronoi algorithm with these gaskets. Finding the center of each circle and giving it a weight.
@glenneric1
@glenneric1 6 ай бұрын
Are you sure you aren't his sleep walking alter ego?
@hamyy6523
@hamyy6523 6 ай бұрын
the simulation saves some RAM by making us share memory 😂😂
@SarahMaeBea
@SarahMaeBea 6 ай бұрын
Every coding train video I watch, pushes me one pixel closer to finally diving in to learning shaders. I don't know what P5 is, I just kinda translate it all to c# in my head, but the concepts and math are where the real magic is! Thank you for making these and making them so easy to digest! Your excitement is infectious.
@Crazyclay78YT
@Crazyclay78YT 6 ай бұрын
hes just using JavaScript, but a little different since its using the P5 library
@terrame1525
@terrame1525 6 ай бұрын
If you get to learning shaders definitely check out shadertoy. It only has the pixel/fragment (the same thing) shader stage, yet it is a great way to start as it enables you to write code and play around with math without being bothered by all the boilerplatey vulkan or opengl bs.
@Varandru
@Varandru 6 ай бұрын
You may be learning how fake the difference between languages is. It isn't totally fake, but it's definitely smaller than it may seem. Especially, say, object oriented ones
@kappasphere
@kappasphere 6 ай бұрын
you don't really need to dive deep in to get started with shaders. You can also just go to shadertoy and try some stuff out
@hirochima26
@hirochima26 6 ай бұрын
i hope you're not on a 8k train XD
@Nightizm
@Nightizm 6 ай бұрын
This is fucking incredible. I'm just a measly web developer who definitely isn't good at math, but I was fully engaged watching you work through this 🤯 I'm so intrigued!!! Thanks for this great video!
@cashewABCD
@cashewABCD 2 ай бұрын
You are a delight. Greatly appreciate your energy.
@footnuke
@footnuke 4 ай бұрын
Oh man I am SO hyped i found your channel and website. This is 100% the kind of programming I've been looking for inspiration and guidance on, for so long! Can't wait to get into some math art deep dives ❤ thank you!
@realcygnus
@realcygnus 6 ай бұрын
👍That really was quite nifty Dan ! One of my favorites perhaps since that Fourier drawing thingy. MUCH thanks for doing what you do.
@65FM1Edits
@65FM1Edits 5 ай бұрын
Hey! I just wanted to say congrats for uploading for so long, I used to watch you when I was 7 years old, 8 years ago and I found you in my recommended again. Glad to see you're still energetic and making good videos :)
@NStripleseven
@NStripleseven 6 ай бұрын
I feel like you might be missing some possible gasket configurations with your choice of third circle. For instance, what if that circle wasn’t directly opposite the second, but instead a bit to one side (and scaled down appropriately)? Then, if done right, you’d have 3 larger circles instead of the 2 or 4 you see in all of yours.
@the_kid777
@the_kid777 5 ай бұрын
2:38 That is precisely what I love about this channel. You know most channels, when reached a certain number of subscribers, become "official" in the sense that they have everything prepared, all clean and on the rails. But the Coding Train isn't, and that is what makes this train so fun to ride!! Keep uploading off-the-rail videos, please!
@A2ne
@A2ne 6 ай бұрын
i made a version of bad apple using apollonian gaskets a while back, and my sloppy python code was so slow that it took like a minute per frame. This is giving me the motivation to finally improve that program.
@angelowentzler9961
@angelowentzler9961 6 ай бұрын
When you generate 3 random circles, 2 within the larger, the 2 inner circles don't necessarily both have their centers on a line with the big circle's center. You could (for instance) have 2 small circles sitting side by side on the inside of the big circle. This way you can have asymmetrical starting positions which should be neat.
@videosformyassignments2189
@videosformyassignments2189 6 ай бұрын
I think the easier approach [O(n^2)] would be to use exponentials. Finding the angle and magnitude of each complex vector and normalizing one vector's magnitude with respect to the other would let you multiply (normalized magnitude)*e^(i*theta1) with (magnitude of the second vector)*e^(i*theta2). Meaning you would just be adding theta1 with theta2 and the resultant complex multiplication would become = "(normalized magnitude)*(magnitude of the second vector)*cos(theta1+theta2) + i*sin(theta1+theta2)" Great vdo! Loved it. I got a weak spot Decartes thm :D
@nosratullahmohammadi1098
@nosratullahmohammadi1098 6 ай бұрын
I really enjoyed watching this video. Thanks for your simple explanations throughout the coding.
@jamesgoodrich6927
@jamesgoodrich6927 6 ай бұрын
When you were debugging the descartes function, it was easy to forget that the bend values are signed, and thus can be negative. What eventually became the local product variable has a negative k1 value, because c1 always had a negative bend value, therefore, the sum of the k1 * k2 and k1 * k3 terms can have a significantly more negative value than what k2 * k3 might have as a positive value, for the intial invocation.
@0_-
@0_- 6 ай бұрын
I still don't understand why k1 has to be negative
@mareletudor
@mareletudor 6 ай бұрын
yaaaaay its pi daaaay!!! have a hapPI day, everyone!
@Amr-Ibrahim-AI
@Amr-Ibrahim-AI 6 ай бұрын
It was a pleasure watching this coding challenge, as always. The way you build up things is simply amazing. Thanks for the inspiration 🙏
@ringo2715
@ringo2715 6 ай бұрын
This has been one of my favorite videos you've done yet
@johnborg305
@johnborg305 5 ай бұрын
Wow. We need more teachers in the world like you. I never went to school for coding but ive learned c, html, css, js, and python through free havard classes. It was very hard for me to understand code but the fact that you arent just reading off code as you go but you show the process of code and how to think it out. Absolutely beautiful content and keep doing what you do!
@SpencerBuchanan
@SpencerBuchanan 6 ай бұрын
I have been doing this as a zentangle with pen to paper for years! I have wanted to learn how to do this in code for a while now. The variation that I want to use this for is to have multiple circles draw a straight line by staggering them on either side. I want to overlay line drawings on this algorithm and let it follow those lines in the drawing, kind of like how you make images from the stipling technique you did in a recent vid. My daughters subbed to your channel on my account and I am glad they did. These are super helpful.
@odarkeq
@odarkeq 6 ай бұрын
I appreciate the amount of energy your thought process burns. I couldn't watch this in one sitting. Kudos.
@zariski
@zariski 6 ай бұрын
The video is very good. a good example of use is thinking about clusters of places in maps api. I did something similar a few years ago with OSM and Leaflet to add points outside of clusters and not overlap. Thank you very much for the excellent content.
@retrogamingfun4thelife
@retrogamingfun4thelife 6 ай бұрын
you could animate the Gasket by slowly changing the coords and the size of the first inner circle
@MyCodingDiary
@MyCodingDiary 6 ай бұрын
This video is like a ray of sunshine on a cloudy day.
@sutyi06
@sutyi06 6 ай бұрын
All of his videos are. I don't even know how to describe the vibe of these videos, but it's so good...
@flobiish
@flobiish 4 ай бұрын
@35:00 allCircles[0] and [1] are the new internal ones. [2] and [3] are "new" external ones which happen to coincide with the outer circle. My initial instinct is to write a function to compare all the circles and return only unique ones, but due to the nature of the circles possible placements and the specific goal of the fractal, ignoring all outer ones is probably the best option...unless the starting circles aren't kissing. A consolidation array might be useful though.
@richarddjarbeng7093
@richarddjarbeng7093 5 ай бұрын
I found this channel yesterday from the book of shaders website. Looks like I'm a bit late to the party. However, it seems it's not too late and he's still releasing videos. I just hope some of the previous challenges (the Machine learning ones esp.) will still work. Also, keep up the good work.🙂
@BaronVonTacocat
@BaronVonTacocat 6 ай бұрын
Shout-out to F Soddy; the man made some poetry.
@CocoaBeans660
@CocoaBeans660 6 ай бұрын
Hey man, just wanted to let you know you your videos are very entertaining and are a great source for me to improve at programming. I'm going to college next year for comp sci and you were a great inspiration.
@ethanhermsey
@ethanhermsey 6 ай бұрын
Dan, I've been watching you for so many years now. I wanted to let you know that the biggest thing you taught me isn't actually the code. I've thought for the longest time that I was too weird to be suitable for a serious job in programming. You showed me that it's okay to be weird and still deserve to be respected. I'll always be grateful for that ❤
@grumpyparsnip
@grumpyparsnip 6 ай бұрын
This is my favorite coding challenge ever!
@Roger-rm3fz
@Roger-rm3fz 6 ай бұрын
Tack!
@rahulshastri9278
@rahulshastri9278 6 ай бұрын
Love your content!! Happy pie day to all.
@lydzzz
@lydzzz 5 ай бұрын
you made me understand coding. you are as iconic as bill nye the science guy
@subinaypanda9936
@subinaypanda9936 6 ай бұрын
Look how excited you were when the the complex thing works. I also love these mathematics and then implementing those in programs.
@Fuchspower
@Fuchspower 5 ай бұрын
54:03 I tried to make sense out of this and this is what I suggest "went wrong": The paper you use the formula from is for the general case while yours implies that 2 circles are inside the bigger third one, giving the identity r1 = r2 + r3 (*) Also, this implies that all centers are on one line. By definition of curvature, we get k1 = -1/r1, k2 = 1/r2 and k3 = 1/r3. If we look at the radicant and replace k1-3, we get the following: k1*k2+k2*k3+k1*k3 = (-1/r1)*(1/r2) + (1/r2)*(1/r3) + (-1/r1)*(1/r3) = - (1/r1*r2) + (1/r2*r3) - (1/r1*r3) If we combine fractions, we follow with = - (r3 / r1 * r2 * r3) + (r1 / r1 * r2 * r3) - (r2 / r1 * r2 * r3) = ( - r3 + r1 - r2 ) / (r1 * r2 * r3). As we figured with (*), the numerator becomes 0, making the whole term calculate to 0. So basically, in your case, you could have skipped the square part entirely, at least for the first iteration. That's also why you got doubled circles in your first iteration initially. I guess the radicant became negative because some floating point inaccuracies, especially due to using random numbers. Actually, if we look at your debug, we do get a super small number, which also solidifies the assumption. As for further iterations, the square term is indeed needed, just to make this clear.
@RickClark58
@RickClark58 6 ай бұрын
Very cool. I have never heard of these before.
@xavierfischer3499
@xavierfischer3499 6 ай бұрын
39:50 that moment expresses so well the joy of coding ❤
@TankorSmash
@TankorSmash 6 ай бұрын
Thank you for reducing the sound of the 'error buzz' sound effect around 25:10!
@sentry4944
@sentry4944 6 ай бұрын
Conductor stop the train. My brain hurts. But seriously, that is really cool math. I really need to start playing with P5.
@berdore
@berdore 6 ай бұрын
Super interesting and fun as always. Can’t wait for the 2nd edition of the book!
@linuss9710
@linuss9710 6 ай бұрын
I come to your channel every PI-day knowing you upload something cool that day.
@mrpithon
@mrpithon 6 ай бұрын
Most coding challenges I watch, I believe I can also complete. This one... this one I won't even try. This was by far the most complicated Coding Challenge I've seen.
@SanthoshKumar-vd3bh
@SanthoshKumar-vd3bh 5 ай бұрын
This dude is the coolest coding did ive ever seeen😂😂😂
@mattm837
@mattm837 6 ай бұрын
Is there anything interesting about the invalid circles? It looked like they formed some kind of pattern. Great video, Happy Pi day!
@chroy_
@chroy_ 5 ай бұрын
great video, love your enthusiasm, its so contagious.
@aioia3885
@aioia3885 6 ай бұрын
I used to watch your videos when I was still learning programming for the first time. It's really nice to see your videos continue to be so much fun and educational! Only thing that bothers me a little is that I don't think that every possible Apollonian Gasket can be generated in the way shown in the video. For example an Apollonian Gasket made by three mutually tangent circles of the same radius inside of the bigger circle won't be generated, unless I'm wrong about this. You could instead generate two different random points inside the big circle and try to find their radii knowing they are tangent. It requires solving some equations but it's not too hard if I remember correctly. Edit: just noticed that some people might have already pointed this out, sorry if this comment was repetitive
@vernonturner3113
@vernonturner3113 6 ай бұрын
Make it tall and have an Apollonian Gasket pencil holder.
@ValleyOfWillows
@ValleyOfWillows 6 ай бұрын
A thought occurred while checking the part about complex numbers (don't know if it's true): If you would add the radius of the 4th circle to the radii of the circles with a positive curviture + if you would subtract the radius of the 4th circle from the radii of the circles with a negative curviture, then the points where those 3 new circles dissect should be the center points of all possible positions for the 4th circle.
@dimBulb5
@dimBulb5 6 ай бұрын
Brilliant and fun as always! Thanks! 😃
6 ай бұрын
I literally love you, thank you so much I have sooooo much fun with you ❤❤❤❤❤
@TheXtrembug
@TheXtrembug 6 ай бұрын
If only I'd had a teacher like you, many things would have gone differently for me
@davidrop
@davidrop 4 ай бұрын
I get that you have your awesome job, but here on youtube you have 1.6 Million students waiting for the new lesson. Imagine that if I meet someone who wants to learn to program I tell them "watch all the coding train videos to get started". I say at least for Coding train's birthday on July 10th you could give us a surprise :D
@mitromanzukal9216
@mitromanzukal9216 6 ай бұрын
This is a very great video and I enjoyed watching it. But on a side note: you missed some solutions. The square root of a complex number has two solutions. The other solution is rotated by pi. And the angle of a complex number can not only be defined by tan, because then you would miss the edge cases and certain rotations (e.g. -b / -a) Edit: The +/- infront of the square root is already the rotation py pi.
@KX36
@KX36 4 ай бұрын
just started thinking about how many kissing ellipses you can have for a number of separate initial ellipses, and it's pascal's triangle.
@colebot
@colebot 6 ай бұрын
I never thought I would read a poem describing a mathematical theorem
@PMA_ReginaldBoscoG
@PMA_ReginaldBoscoG 6 ай бұрын
Dear Dan, please make a 3d version of the Apollonian Gasket. I would be happier if you did it.
@larswilms8275
@larswilms8275 6 ай бұрын
Do you really want to see Dan struggle with quaternions? Give the man a break, he's a coding art teacher not a coding math teacher.
@tomiscattini
@tomiscattini 6 ай бұрын
I love your videos, thank you!
@MrBadSmash
@MrBadSmash 6 ай бұрын
Just want to let you know that, for me, it's fine when you take a long time to start coding. I don't watch you JUST to watch you code--I love the math, too!
@DeathSugar
@DeathSugar 6 ай бұрын
Can you make gasket out of N initial EQUAL circles, not just 2?
@geoffwagner4935
@geoffwagner4935 5 ай бұрын
2Blue1Brown did 2 transformations videos the last week, now I'd kind of like to see maybe more transformations videos on coding train. You also said you intended to possibly go into more "extra dimensional that couldn't be visualized". not that anyone's expecting all that , the transformations theme seam fun though , or an unreal engine lol both :) do a "Shiff Sims" with transformations "the ring" technology from "autoencoder", all three.
@gownerjones
@gownerjones 6 ай бұрын
My pet theory why it is called a gasket: The outer ring seals everything inside but the inner surface consists of infinite holes, so is infinitely porous, it lets everything through. Sealed at the edge but open in the middle is exactly what a gasket should be like.
@vincentcaliendo6402
@vincentcaliendo6402 5 ай бұрын
It’s Vincent from NYU. Dekalb Q train. Music and Programming
@dougmcfarlane
@dougmcfarlane 5 ай бұрын
Next, modify the code to work with 3D spheres, instead of 2D circles. I would expect adding a 'z' component wouldn't be that difficult, but then I didn't understand about 25% of what you were saying towards the end, especially the Complex number portion. Fun stuff.
@wonghw
@wonghw 6 ай бұрын
It is an incredible tutorial
@letsgocamping88
@letsgocamping88 6 ай бұрын
Really enjoyed this one!
@MyCodingDiary
@MyCodingDiary 6 ай бұрын
I wish I could give this video more than one like. It's that good!
@warny1978
@warny1978 6 ай бұрын
Wonder about doing it with spheres ?
@joshuawhitworth6456
@joshuawhitworth6456 6 ай бұрын
I made one in apophasis 7x that is a gasket fractal with infinitely more gasket fractals inside of it. I called the orb fractal.
@kasperchristensen8416
@kasperchristensen8416 6 ай бұрын
When multiplying imaginary numbers, I'm pretty sure it's not A2B2, but rather R2D2 🤖💫
@juljanhaka7086
@juljanhaka7086 6 ай бұрын
Nice! Now, it is interesting if you set that gasket as various systems with their corresponding attributes and apply hysteresis.
@leeblackharry
@leeblackharry 6 ай бұрын
Instead of drawing the circles it would be interesting to see what kind of line path would result from connecting the centers of 3 circles to the new circle.
@cuadernoazul5958
@cuadernoazul5958 6 ай бұрын
Wow a new CT's video! Its party time
@tomek3633
@tomek3633 6 ай бұрын
And as usual: "I will refactor this later ..." *singing*
@refaldybagas
@refaldybagas 6 ай бұрын
Beautiful
@dominick253
@dominick253 5 ай бұрын
You should do a leet code live stream. See just how quickly you can do them.
@alvarofuenzalida2753
@alvarofuenzalida2753 6 ай бұрын
I'm waiting for the new version of the book!
@moodangelatx6580
@moodangelatx6580 6 ай бұрын
Good stuff
@mariobroselli3642
@mariobroselli3642 5 ай бұрын
Hello @thecodingtrain , thanks for the Videos. Processing is amazing. Are there languages similar to it? Also are there any videos on Java and Processing?
@StefanReich
@StefanReich 6 ай бұрын
54:05 Look at the value, it's E-21, so very close to zero. Probably it's a rounding error and just supposed to be zero
@alexsandergutierrezgoncalves
@alexsandergutierrezgoncalves 6 ай бұрын
Happy PI day to all
@koktszfung
@koktszfung 6 ай бұрын
This is why we code
@geoffwagner4935
@geoffwagner4935 6 ай бұрын
On my Raspberry Pi 5, on Pi Day, on Dan's Pi challenge, and comment #10! Just did last Pi day yesterday and commented I hope we have another Pi day stream, happy to see an isn't a spoiler and ignored my comment. If he had loved it would not have been a surprise
@louamacademie5837
@louamacademie5837 5 ай бұрын
You are making a wonderfull easy to learn videos Thank you so much And i really want to ask you for a ml5 handpose video I would love to apply what you teached us in posenet in a handpose project ❤ Hope you find the time for that :")
@DarylJewkes
@DarylJewkes 6 ай бұрын
Happy Pi Day, Dan!
@harrywizards3323
@harrywizards3323 6 ай бұрын
i have learnt a lot from your vedio but i cant implement anything by myself what do i do?
@DipamSen
@DipamSen 6 ай бұрын
Happy π day!
@frollard
@frollard 6 ай бұрын
Excellent work! Is it necessary for the 3rd circle be exactly rotate-by-pi opposite 2nd circle? In theory it just needs to be mutually tangential...it's just symmetric if you rotate 180 degrees.
@jaymistry689
@jaymistry689 5 ай бұрын
I just have one request, make a coding challenge for linear transformation visualization of 2d grid, because I want to do that but I am stuck at one problem of finding the edge of curved line, I know the math but I can't implement it in code, plzzzzzzzzz
@Maukustus
@Maukustus 5 ай бұрын
im more familiar with C++ than js so i thought overloading the operators for the complex number class could work
@kamilsobczak243
@kamilsobczak243 6 ай бұрын
awesome!
@geoffwagner4935
@geoffwagner4935 5 ай бұрын
Remember the 1998 3d windows desktop? maybe it was an earlier "3dna desktop" i remember a slightly different version than first comes up on google, make a unreal ShiffBot Coding Desktop assistant
@garthmacleod
@garthmacleod 6 ай бұрын
Had a beer. Brain broke.
@NonTwinBrothers
@NonTwinBrothers 6 ай бұрын
Damn, and my copy of Indra's Pearls just arrived. What coincidences 😳
@juancer_
@juancer_ 6 ай бұрын
happy pi day!!!!!! 🚂🚂 🚂
@stickmasterlukeRBX
@stickmasterlukeRBX 3 ай бұрын
When we consider each circle filled in, does the Apollonian Gasket have any free space? Also, if I wanted to roll one of the circles, would it lockup or all start spinning?
@geoffwagner4935
@geoffwagner4935 6 ай бұрын
wow, center.x, center.y to center.a and center.b my life fell apart lol i have been console logging objects for hours .... i stuck push(newCircle, c1, c2, c3) and validate(newCircle), and couldn't figure out why i was getting undefined out of my circles dist function, it was empty lol
@justusalho391
@justusalho391 6 ай бұрын
Dan could be a scientist played by Jeff Goldblum
@thenormalguy8574
@thenormalguy8574 6 ай бұрын
i love pi day!
@rubenvanderark4960
@rubenvanderark4960 6 ай бұрын
Happi pi day
@trejkaz
@trejkaz 6 ай бұрын
Oops, this was how I spent my day, although it's the day after half-tau day for me.
Coding Challenge 183: Paper Marbling Algorithm
32:10
The Coding Train
Рет қаралды 76 М.
Apple ][ Coding Challenge: Fractal Tree
35:35
The Coding Train
Рет қаралды 372 М.
SHAPALAQ 6 серия / 3 часть #aminkavitaminka #aminak #aminokka #расулшоу
00:59
Аминка Витаминка
Рет қаралды 747 М.
Je peux le faire
00:13
Daniil le Russe
Рет қаралды 22 МЛН
ПРИКОЛЫ НАД БРАТОМ #shorts
00:23
Паша Осадчий
Рет қаралды 5 МЛН
New Breakthrough on a 90-year-old Telephone Question
28:45
Eric Rowland
Рет қаралды 109 М.
The BEST Way to Find a Random Point in a Circle | #SoME1 #3b1b
18:35
Programming with Math | The Lambda Calculus
21:48
Eyesomorphic
Рет қаралды 189 М.
What's so special about the Mandelbrot Set? - Numberphile
16:53
Numberphile
Рет қаралды 2,4 МЛН
Harder Drive: Hard drives we didn't want or need
36:47
suckerpinch
Рет қаралды 1,7 МЛН
The biggest hand calculation in a century! [Pi Day 2024]
36:50
Stand-up Maths
Рет қаралды 450 М.
Coding Challenge 168: MandelBulb 3D Fractal
28:02
The Coding Train
Рет қаралды 372 М.
Coding Adventure: Ray Tracing
37:58
Sebastian Lague
Рет қаралды 1,1 МЛН
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
SHAPALAQ 6 серия / 3 часть #aminkavitaminka #aminak #aminokka #расулшоу
00:59
Аминка Витаминка
Рет қаралды 747 М.