After years scratching my head about cubic splines, your explanation was the the most intuitive and clear. I will never forget this. Thank you for this great tutorial!
I haven't watched the whole video, but I'm so happy that this exists and that you exists. Your work is incredible, and always makes me fell so happy. Also, I'm a visual artist and a programmer, your channel is perfect for me
I started watching the coding challenge series a weeks ago. For me it's been a week or 2, but for David it's been years! I'm inspired to see the love and enthusiasm he still has!
Well, you probably think of the old win95 mystify screensaver: th-cam.com/video/p-howMhFecQ/w-d-xo.html#t=8s It still existed in win XP: th-cam.com/video/uZQr-gHyYFI/w-d-xo.html This is the classic one. However there's a newer version called Mystify in win10: th-cam.com/video/yE3BTTtPKB4/w-d-xo.html The old one just draws 2 quadrilateral where the 4 points are bouncy balls. Each of the two quadrilaterals have a certain amount of "history". So each frame the bouncy balls advance and a new shape is drawn, but the old ones still remain. so if a shape has a history of 12, there are always the last 12 copies of the shape on screen. When a bouncy ball was reflected it got a random velocity to add more dynamic to it. It was a very simply screensaver. The Win 10 version actually draws "curves". It's hard to tell because they added a lot of blur and glow and it fades out rather quickly. Though it may just be a leading vertex that moves around and drags the other control points behind by some constraints. While the general idea is similar, it works a bit different. They most likely just use a render buffer and never clear it as usual but simply let that buffer fade to black all the time. So the newly drawn shapes are bright while everything else is constantly fading away.
Ive been following this channel for the last 5 years and I went from someone who hated web dev to a working frontend developer. but the best part is I still subconsciously learn more about math than programming and i fucking love that.
14:46 This was the penny drop moment for me! The way the bezier was calculated, and the reason the curve doesn't come close to the control point, suddenly made clear 😮😀
Once again, this guy has blown my mind with his simple, helpful, humerus interpretation and implementation of what would normally be a complex coding nightmare. Bravo, bravo... keep it up Dan...
currently learning some stuff for programming as i intend to study it in some years , the biggest thing about your channels is that you explain it in a really easy way , step by step and even the math behind it! the way you teach , explain and show is so funny and enjoyable! so much talent and so much passion for your channel i love it!
Very nice content! I've implemented this algorithm before and used it frequently , especially bezier animation! I hope you can continue this series because i am very interested in understanding these type of algorithms. You are the man who brings me to the world of computer graphics, thanks man
Tips for beginners: you can imagine a bezier curve like this. you are bob and your friend jane is across the road she is walking to the end of the road in a straight line. but you dont know where she is going, so you look directly at jane and walk forward, as she moves down the road you stay facing toward jane, and continuously walk forward until you meet her at the end of the road. as you walked across the road your foot prints would be a bezier curve. that's how I accidentally discovered bezier curves while trying to make a curve generator in a video game lol. I hope that my explanation will help anyone confused.
A few years back I left a comment underneath a Coding Train video. It was critical because the content was too playful to me and too time-inefficient. I wanted to quickly learn what I had opened the video for. Now, I want to apologise for my arrogance. I think what you have done with Coding Train is nothing short of amazing. I hope many kids will be inspired by you to learn maths, computer science and create art. Never stop.
Really awesome vid. I've been using Bezier curves in Unity for a while even converted bezier code into DOT's code but I didn't understand the underlying bezier code, that is until now thanks to you.
I have always wanted to know how this works! Also I've used a function similar to lurp before and I always wondered how it could do that. Thanks for breaking it down for all of us. Keep up the awesome work!!
Great video. Certainly demystifies the inner workings of Bezier curves. I also wanted to say that the coloured boxes that you draw around snippets of text really help to understand what you trying to point out. Keep up the great work!
i've done a fair bit of drawing with bezier curves and i wrote a lerp fuction once, but i had no idea that a bezier is just a lerp of a lerp. that is so cool! :D
Nobody seems to underline WHY Bezier curves are so wonderful, they changed the way we can mathematically/practically describe very complex curves without using "classic" expressions. The whole mathematic model of a Bezier curve is a set of modules really (I had to calculate them manually for a couple of exams at university back in the day). It's not just "a curve", it's a way to recursively describe a whole range of shapes that would take an insane amount of mathematical tinkering if done differently (nevertheless they allow for much more precise industrial calc for design and manufacturing). Edit: I am no mathematician sorry for my sloppy explanation but I hope you get the idea, feel free to correct me if something is too sketchy ^^
Wow. Didn't realise that lerp did this for this bezier curve. Here I was scratching my head for months with loads of nonsense formulas I can now create a racing track game that cars can follow the bezier curves with ease.. Genius Cheers.
Amazing explanation for bezier curves! This explanation was so good that I probably will not forget how bezier curves are drawn, not after having heard the term "lerpception" XD. Once again, awesome explanation!
I remember when I was a kid and discovered that you can make a curve with straight lines and I started drawing a bunch of those curves messing with all sorts of parameters, apparently young had just rediscovered bezier curves, that's really cool
Oh man... you and your pineapple shirt... you brought a smile to my face already at 4:30... you got the gift of teaching... One would never snooze at your presentations.... very well done.
That is an awesome explanation! Thanks for that! Got stuck on bezier curves a while back while trying to solve the Mars lander challenge on codingame. Maybe I'll give it another go, since I now know that bezier curves are not that mystical.
Rather than making separate functions for the Quadratic and the Cubic and so on, I approached it recursively using 2 functions. The first one taking in an array of points and a t value. which either returns the lerp of the 2 points if there are only 2 values. Otherwise it calculates the lerps between each pair of points stores them as a new array of points and feeds them back in to its self. Essentially this function returns the point value of the Bezier at the t value supplied. The second function takes the original array or points and a "resolution" integer value. This one essentially takes the resolution number of points and plots the loops over the t values to plot the points to the Bezier curve calculated with the supplied control points. The whole lot is then returned as an array of points.
// Written in Java //Vector2D is my own vector class. //Lerp is also my own lerp class public static Vector2D getPointAtT(Vector2D[] controlPoints, double t) { if(controlPoints.length==2) return Lerp.lerp(controlPoints[0], controlPoints[1], t); else { Vector2D[] newControlPoints = new Vector2D[controlPoints.length-1]; for(int i=0; i
I don't know if anyone has already said this, at 15:25 the last tangent line isn't drawn I think to fix this you change code to: for(let t=0; t < 1+delta; t+=delta) I think the reason is 100 segments has 99 divisions so you lerp 1 less than how many segments/resolution you want.
Awesome tutorial as always, I hope it might help but to avoid the js rounding I wrote (in Processing) for(float t=0; t < 1+delta; t+=delta), I'm not sure it's the best solution but I think it might be more adaptable when delta changes. Anyway, the tutorial was extraordinary :D
If I'd learned about Bezier curves this way in school I could have saved a lot of time. Calculating it as nested lerp functions instead of polynomials (the deCasteljau algorithm) is indeed more computationally expensive, but it's also more numerically stable.
To avoid the "javascript-error", it actually occurs everywhere, if you use floating-point numbers. Just use for t integer values, or better introduce i as an integer for your iteration and then in the body of the loop define a t, then your iterations are accurate and you can still use t as an float for your calculations.
By the way, you could have a recursive Bezier creator, as well as a version with the nets, very easily if you instead passed a list of vectors. Roughly, you recursively call it for a lower degrees on both all but the last vector, and all but the first vector, then you lerp the output vectors as in the video. The base case would be the line (first degree)
There are more than just the line, quadratic and cubic beziers. You can get as many control points as you want. For example, you could have a bezier with 100 control points.
I wish all math/geometry and calculus implementations are taught like this (advance calculus, etc.) to learn intuitively than just memorize formulas and their implementations.
In the mid 1980's I programed Bezier curves on Atari 8 bit using Atari Basic. Using random control points and connected end points I could do "human" like scribbling.
If you have rounding errors in a for loop using floating point numbers, the proper way to solve it it so iterate an integer and then divide it inside the loop.
This guy has such a talent for breaking down complex topics into digestible information. I am so grateful for this channel.
Hey, inspired by you, I downloaded processing, and is now learning about data types. Thanks for your wholesomeness, and positivity.
please don’t be a jerk and just be a good friend
After years scratching my head about cubic splines, your explanation was the the most intuitive and clear. I will never forget this. Thank you for this great tutorial!
I really enjoyed seeing the code for that one screensaver from the 90s.
I haven't watched the whole video, but I'm so happy that this exists and that you exists. Your work is incredible, and always makes me fell so happy. Also, I'm a visual artist and a programmer, your channel is perfect for me
The cool thing about this channel is that it literally covers almost every aspect of programming, even the JavaScript libraries.
Keep it up!
wow, that was a great video. all those details, the video itself, the use of timestamps, the way it's cut/presented, just... everything
I started watching the coding challenge series a weeks ago. For me it's been a week or 2, but for David it's been years!
I'm inspired to see the love and enthusiasm he still has!
I love it too, but who is david?
@@cassiofbsI am david
I love this video! I wish I had seen in High school; the '90s.
the bouncing particles at the end really reminded me of the dvd thing hitting the corner of the screen
"I don't know what I've made here..."
Why, you've made an old Windows screensaver, of course.
I can't possibly be the only one who remembers this one!
Not the only one. I am from the 90s too.
He should remake the pipes ones
Well, you probably think of the old win95 mystify screensaver:
th-cam.com/video/p-howMhFecQ/w-d-xo.html#t=8s
It still existed in win XP:
th-cam.com/video/uZQr-gHyYFI/w-d-xo.html
This is the classic one. However there's a newer version called Mystify in win10:
th-cam.com/video/yE3BTTtPKB4/w-d-xo.html
The old one just draws 2 quadrilateral where the 4 points are bouncy balls. Each of the two quadrilaterals have a certain amount of "history". So each frame the bouncy balls advance and a new shape is drawn, but the old ones still remain. so if a shape has a history of 12, there are always the last 12 copies of the shape on screen. When a bouncy ball was reflected it got a random velocity to add more dynamic to it. It was a very simply screensaver.
The Win 10 version actually draws "curves". It's hard to tell because they added a lot of blur and glow and it fades out rather quickly. Though it may just be a leading vertex that moves around and drags the other control points behind by some constraints. While the general idea is similar, it works a bit different. They most likely just use a render buffer and never clear it as usual but simply let that buffer fade to black all the time. So the newly drawn shapes are bright while everything else is constantly fading away.
@@cipher3966same
Ive been following this channel for the last 5 years and I went from someone who hated web dev to a working frontend developer. but the best part is I still subconsciously learn more about math than programming and i fucking love that.
You read the minds of artists/programmers: all your tutorials are gold!
It's so sad to see you getting old. Love you Daniel! You are amazing. :):
the explanation of the white bord.just wow! . thank you sir.
Absolutely one of your best videos yet! Keep up the great work!
This is phenomenally useful and such a good breakdown. I've been clueless all morning; now 20 minutes later I'm sorted. Such a great video!
Very lucid :-) For those interested, the mathematical process of finding a curve tangent to a family of lines (or curves) is known as an envelope.
14:46 This was the penny drop moment for me! The way the bezier was calculated, and the reason the curve doesn't come close to the control point, suddenly made clear 😮😀
Daniel, I love the work you're doing. Thanks for teaching!
The Bezier function was explained in such a casual and easy way. Just beautiful to watch!
Once again, this guy has blown my mind with his simple, helpful, humerus interpretation and implementation of what would normally be a complex coding nightmare. Bravo, bravo... keep it up Dan...
Thanks so much for the video, when you explain it, it is very intuitive and very easy to understand.
I've had a rough couple of weeks but this does put a smile on my face and I don't know how. Thank You.
currently learning some stuff for programming as i intend to study it in some years , the biggest thing about your channels is that you explain it in a really easy way , step by step and even the math behind it! the way you teach , explain and show is so funny and enjoyable! so much talent and so much passion for your channel i love it!
You're so passionate about teaching and coding, thank u so much all this free information
I love watching these videos. These really are just amazing. With all of the lines, these absolutely resemble "shade sails".
Just want to say the production is on another level now! I've been a fan for a while, and love your clear explanations!
Thank you, glad to hear that! (Especially given I had some audio issues with this one)
@@TheCodingTrain Yes, I love the way the production quality has evolved over the past 6 years that I've been watching! :D
Used this to draw tubing for a project but didn't know the math behind it. Very interesting to see, thank you
This might just be the best programing channel on the entire internet
I really enjoyed that! You made your very own Windows 95 Screen Saver!
Thanks for this video. I've been trying to come to grip with curves for decades
A developer for 10 years now, and watching this channel makes me love coding again.
When I get a job I'll donate again. Thank you for your work. Helped me get my last job
That's only one channel all over the TH-cam which I like a lot I love to learn with u that's awesome moment
The master of inspiration
I never understood what is lerp function
Now its soo clear
❤
Very nice content! I've implemented this algorithm before and used it frequently , especially bezier animation!
I hope you can continue this series because i am very interested in understanding these type of algorithms.
You are the man who brings me to the world of computer graphics, thanks man
Tips for beginners: you can imagine a bezier curve like this. you are bob and your friend jane is across the road she is walking to the end of the road in a straight line. but you dont know where she is going, so you look directly at jane and walk forward, as she moves down the road you stay facing toward jane, and continuously walk forward until you meet her at the end of the road. as you walked across the road your foot prints would be a bezier curve.
that's how I accidentally discovered bezier curves while trying to make a curve generator in a video game lol. I hope that my explanation will help anyone confused.
A few years back I left a comment underneath a Coding Train video. It was critical because the content was too playful to me and too time-inefficient. I wanted to quickly learn what I had opened the video for.
Now, I want to apologise for my arrogance. I think what you have done with Coding Train is nothing short of amazing. I hope many kids will be inspired by you to learn maths, computer science and create art. Never stop.
Really awesome vid. I've been using Bezier curves in Unity for a while even converted bezier code into DOT's code but I didn't understand the underlying bezier code, that is until now thanks to you.
Great explanation, finally these equations make sense
Congratulations you made the old Windows Bezier screen saver!
This is awesome.
I'm not saying I'm watching this while on mushrooms. I'm just saying if I _were_ watching this, there's _a chance_ I'm watching it while on mushrooms.
I’m not saying that I don’t care but there is an high chance I do not care
I have always wanted to know how this works! Also I've used a function similar to lurp before and I always wondered how it could do that. Thanks for breaking it down for all of us. Keep up the awesome work!!
This is complex to me but the initial explanation made my understanding of this concept clearer. Thank you for this wonderful content!
Great video. Certainly demystifies the inner workings of Bezier curves.
I also wanted to say that the coloured boxes that you draw around snippets of text really help to understand what you trying to point out.
Keep up the great work!
i've done a fair bit of drawing with bezier curves and i wrote a lerp fuction once, but i had no idea that a bezier is just a lerp of a lerp. that is so cool! :D
Same! That is just mind blowing to me!
The cubic Bézier curve we love is a lerp of a lerp of a lerp!
@@cmyk8964 or a lerp of two lerps, that's how i like to think of it.
Nobody seems to underline WHY Bezier curves are so wonderful, they changed the way we can mathematically/practically describe very complex curves without using "classic" expressions. The whole mathematic model of a Bezier curve is a set of modules really (I had to calculate them manually for a couple of exams at university back in the day). It's not just "a curve", it's a way to recursively describe a whole range of shapes that would take an insane amount of mathematical tinkering if done differently (nevertheless they allow for much more precise industrial calc for design and manufacturing).
Edit: I am no mathematician sorry for my sloppy explanation but I hope you get the idea, feel free to correct me if something is too sketchy ^^
Wow. Didn't realise that lerp did this for this bezier curve.
Here I was scratching my head for months with loads of nonsense formulas
I can now create a racing track game that cars can follow the bezier curves with ease..
Genius
Cheers.
I was soo happy to see processing update their website to a react webapp!
Amazing explanation for bezier curves! This explanation was so good that I probably will not forget how bezier curves are drawn, not after having heard the term "lerpception" XD. Once again, awesome explanation!
A topic I always wanted to learn.. Thanks Dan..
woah, bézier lines make sense now!
I love your passion! Thanks for the great tutorials and coding challenges :)
I remember when I was a kid and discovered that you can make a curve with straight lines and I started drawing a bunch of those curves messing with all sorts of parameters, apparently young had just rediscovered bezier curves, that's really cool
i actually used to do the same thing, when I saw the string art i was like wait what
Another mind-blowing video. Congrats!
Congrats! You made a screensaver from windows 98! Beautiful!
Damn, and here I was scrolling through and feeling smug that nobody had mentioned it yet.
Sigh.
I love your videos, especially coding challenges so informative :)
Dan, you are a force of the nature. Thank you man!
Oh man... you and your pineapple shirt... you brought a smile to my face already at 4:30... you got the gift of teaching... One would never snooze at your presentations.... very well done.
Please do a tutorial on mapping stars against a sky sphere, i.e. declination and right ascension co-ordinates for a star map, mapped onto a screen.
i'll probably remember bezier curve as LERPCEPTION forever xD
thank you so much for such a simple but great explanation!
like usual , always stunning ! thank you , love it
Now I know how kuka's robot spline function works! Thank you
That is an awesome explanation! Thanks for that!
Got stuck on bezier curves a while back while trying to solve the Mars lander challenge on codingame. Maybe I'll give it another go, since I now know that bezier curves are not that mystical.
I had a chance to write some dancing graphics with splines in X11 on a SunOS back in college. Great video on how splines work. Thanks!
Awesome. I enjoyed that very much.
Rather than making separate functions for the Quadratic and the Cubic and so on, I approached it recursively using 2 functions.
The first one taking in an array of points and a t value. which either returns the lerp of the 2 points if there are only 2 values. Otherwise it calculates the lerps between each pair of points stores them as a new array of points and feeds them back in to its self. Essentially this function returns the point value of the Bezier at the t value supplied.
The second function takes the original array or points and a "resolution" integer value. This one essentially takes the resolution number of points and plots the loops over the t values to plot the points to the Bezier curve calculated with the supplied control points. The whole lot is then returned as an array of points.
// Written in Java
//Vector2D is my own vector class.
//Lerp is also my own lerp class
public static Vector2D getPointAtT(Vector2D[] controlPoints, double t) {
if(controlPoints.length==2) return Lerp.lerp(controlPoints[0], controlPoints[1], t);
else {
Vector2D[] newControlPoints = new Vector2D[controlPoints.length-1];
for(int i=0; i
Seeing cubic calling quadratic brings to mind the possibility of a quintic bezier, or even a recursive function that can go even further...
You made a screensaver, and it is awesome!
This is underrated!
Happy teacher's day....Guru ji 😊❤️ from India 😊
Right in the moment when i neede it! Thank you for a great content!
Nice. I've been following you for a hort time but already love your videos so much, that I started making my own videos inspired by you. Thanks
Amazingly explained. I don't have to say more. :) Bezier Curves are amazing.
I don't know if anyone has already said this, at 15:25 the last tangent line isn't drawn I think to fix this you change code to:
for(let t=0; t < 1+delta; t+=delta)
I think the reason is 100 segments has 99 divisions so you lerp 1 less than how many segments/resolution you want.
Very well done video!!... Congrats you made a bezeir screensaver😆
Awesome tutorial as always,
I hope it might help but to avoid the js rounding I wrote (in Processing) for(float t=0; t < 1+delta; t+=delta), I'm not sure it's the best solution but I think it might be more adaptable when delta changes.
Anyway, the tutorial was extraordinary :D
I love the "and because they are seperate lines - I can make them rainbow colored" - part.
If I'd learned about Bezier curves this way in school I could have saved a lot of time. Calculating it as nested lerp functions instead of polynomials (the deCasteljau algorithm) is indeed more computationally expensive, but it's also more numerically stable.
Another great video, thanks so much.
liking the post editing. great vid :)
To avoid the "javascript-error", it actually occurs everywhere, if you use floating-point numbers. Just use for t integer values, or better introduce i as an integer for your iteration and then in the body of the loop define a t, then your iterations are accurate and you can still use t as an float for your calculations.
love your videos! its practical, unique, challenging, and informative =)
Freya Holmér just made a great video about bezier curves a few days ago
I know!! It is so beautiful
By the way, you could have a recursive Bezier creator, as well as a version with the nets, very easily if you instead passed a list of vectors. Roughly, you recursively call it for a lower degrees on both all but the last vector, and all but the first vector, then you lerp the output vectors as in the video. The base case would be the line (first degree)
Thanks, very informative and entertaining.
There are more than just the line, quadratic and cubic beziers.
You can get as many control points as you want.
For example, you could have a bezier with 100 control points.
As someone used to Inkscape, these feel really natural
Heel erg mooi, dank u voor de video J. Oswald
I wish all math/geometry and calculus implementations are taught like this (advance calculus, etc.) to learn intuitively than just memorize formulas and their implementations.
Entertaining and educational as always! Love ya, man!
WHOA - when did your channel videos get so incredibly condensed and polished?
It's unclear to me if it's universally an improvement or not but this is all thanks to the work of Coding Train editor extraordinaire @mathblank!
@@TheCodingTrain I’d say it is. It’s easier to digest the videos in a timely fashion, and it cuts out the fat.
You should take a look at making n-degree bezier curves and operations on them using matrices, it's much much simpler
Thank you! This is a great tutorial.
In the mid 1980's I programed Bezier curves on Atari 8 bit using Atari Basic. Using random control points and connected end points I could do "human" like scribbling.
Inspiring stuff, as always
great work thank you!
Let's see you code a NURBS curve and intersections between curves and lines!
If you have rounding errors in a for loop using floating point numbers, the proper way to solve it it so iterate an integer and then divide it inside the loop.