GLBasic forum

Codesnippets => Math => Topic started by: Kitty Hello on 2017-Jul-21

Title: Bezier curves / Splines - through points
Post by: Kitty Hello on 2017-Jul-21
With Hemlos' lib you can interpolate spline curves, if you know the control points. http://www.glbasic.com/forum/index.php?topic=3839.msg28012#msg28012 (http://www.glbasic.com/forum/index.php?topic=3839.msg28012#msg28012)
I continued this and will generate the control points for a polygonal line, so the curve touches all your input points in order.

See the example - just click points with your mouse, the spline will be generated interactively.

It's very useful to generate racing tracks or curves for cars that follow a route.
Title: Re: Bezier curves / Splines - through points
Post by: Ian Price on 2017-Jul-21
That might come in very handy at some point. Cheers Gernot. Nice to see you about BTW :)
Title: Re: Bezier curves / Splines - through points
Post by: erico on 2017-Jul-28
Wait...who is this user? I better report it to the moderators! =D

Indeed, the code is superbly clean and small, a quick look and it seems even the likes of me can use it and there are many uses to put such into action. Great work!
I have plotted many far away from each points to check how the older points (till what level?) would conform, the result is really great! :)
Title: Re: Bezier curves / Splines - through points
Post by: MrPlow on 2017-Aug-27
Cool - will check this out - I did my  own beziers for one of my games...but a library is always handy!! :)
Title: Re: Bezier curves / Splines - through points
Post by: bigsofty on 2017-Aug-28
Very handy for baddie or camera movement patterns too. Great stuff!  :good: