Author Topic: Bezier curves / Splines - through points  (Read 253 times)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10638
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
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
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.

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4090
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: Bezier curves / Splines - through points
« Reply #1 on: 2017-Jul-21 »
That might come in very handy at some point. Cheers Gernot. Nice to see you about BTW :)
I came. I saw. I played.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4041
    • View Profile
    • Portfolio
Re: Bezier curves / Splines - through points
« Reply #2 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! :)

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1151
    • View Profile
Re: Bezier curves / Splines - through points
« Reply #3 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!! :)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2453
    • View Profile
Re: Bezier curves / Splines - through points
« Reply #4 on: 2017-Aug-28 »
Very handy for baddie or camera movement patterns too. Great stuff!  :good:
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)