Cubic Spline? Anyone?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Cubic Spline? Anyone?
Hi.
I have been using the graph widget but I would like to convert a scattered set of points (X,Y) to a smooth curved line (like in the attachment).
So, giving up the graph widget, I did some research and I realized that:
- my math sucks
- probably i need to do "cubic spline interpolation" (!?)
Somebody has done this already or is willing to share some simple math example?
Thanks
(I've seen the BezieCurve in the Rasberry section but I am not sure if is the correct example to study)
I have been using the graph widget but I would like to convert a scattered set of points (X,Y) to a smooth curved line (like in the attachment).
So, giving up the graph widget, I did some research and I realized that:
- my math sucks
- probably i need to do "cubic spline interpolation" (!?)
Somebody has done this already or is willing to share some simple math example?
Thanks
(I've seen the BezieCurve in the Rasberry section but I am not sure if is the correct example to study)
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Cubic Spline? Anyone?
https://en.wikiversity.org/wiki/Cubic_S ... polynomial.
Ooer: that only served to remind me that, at about 16, I got off the 'Maths Train.'
Ooer: that only served to remind me that, at about 16, I got off the 'Maths Train.'
Re: Cubic Spline? Anyone?
Gasp!
Not very helpful to me.
I need some LC code
Not very helpful to me.
I need some LC code
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Cubic Spline? Anyone?
Actually that Wikipedia page explains things in a comparatively comprehensible fashion.
Re: Cubic Spline? Anyone?
I like to think I'm OK at maths but that wikipedia page made my eyes water...richmond62 wrote: ↑Mon Aug 24, 2020 7:51 pmhttps://en.wikiversity.org/wiki/Cubic_S ... polynomial.
Ooer: that only served to remind me that, at about 16, I got off the 'Maths Train.'
A cursory search found this: livecode-bezier-line-demo
Untested and don't know if it will help, but worth a look...
Last edited by stam on Wed Nov 25, 2020 3:05 pm, edited 1 time in total.
Re: Cubic Spline? Anyone?
I was alway weak at math, and yes, I immediately closed the page above when I saw it!
Ah, one of Scott Rossis stacks, can't be wrong and will surely look gorgeous!stam wrote: ↑Tue Nov 24, 2020 12:55 pmA cursor search found this: livecode-bezier-line-demo
Untested and don't know if it will help, but worth a look...
Re: Cubic Spline? Anyone?
I'm looking for that function to smooth the points of a curve graphic!
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Cubic Spline? Anyone?
https://use-livecode.runrev.narkive.com ... aphic-oval
Frankly, I'm drunk, but I'll get back to this chestnut when I sober up.
And, oddly enough, through an alcoholic haze, the word 'interpolation' crops up.
AND, "Krishna on a bike", trying to send an SVG file of a boardgame to a Laser printer via some extremely wonky Chinglish
documentation at the moment, and/or generate "G Code" via an Inkscape extension to do the same, while thinking
about smoothing curves.
Frankly, I'm drunk, but I'll get back to this chestnut when I sober up.
And, oddly enough, through an alcoholic haze, the word 'interpolation' crops up.
AND, "Krishna on a bike", trying to send an SVG file of a boardgame to a Laser printer via some extremely wonky Chinglish
documentation at the moment, and/or generate "G Code" via an Inkscape extension to do the same, while thinking
about smoothing curves.
Last edited by richmond62 on Tue Jun 14, 2022 7:53 pm, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Cubic Spline? Anyone?
Well, I certainly had fun playing with this:
go url "http://tactilemedia.com/blog/bezier"
It is a very great sadness that Alejandro 'vanished'.
The thing that really rocked was that I had never come across a
handler before . . .
go url "http://tactilemedia.com/blog/bezier"
It is a very great sadness that Alejandro 'vanished'.
The thing that really rocked was that I had never come across a
Code: Select all
before mouseDown
Re: Cubic Spline? Anyone?
Everything on Scott Rossi's blog post is worth looking at.
I especially liked the translucent flashing stack: animated WindowShapes
http://tactilemedia.com/blog/2018/05/12 ... -the-past/
------------
edit: having had a closer look at the animated windowshapes stack again i must admit it's clever
the main image is basically an animated PNG where each frame's binary data is stored in a custom prop of the base image and is just cycled through.
Simple but effective!
I especially liked the translucent flashing stack: animated WindowShapes
http://tactilemedia.com/blog/2018/05/12 ... -the-past/
------------
edit: having had a closer look at the animated windowshapes stack again i must admit it's clever
the main image is basically an animated PNG where each frame's binary data is stored in a custom prop of the base image and is just cycled through.
Simple but effective!