Page 1 of 1

Cubic Spline? Anyone?

Posted: Mon Aug 24, 2020 6:07 pm
by trevix
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)

Re: Cubic Spline? Anyone?

Posted: Mon Aug 24, 2020 7:51 pm
by richmond62
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.'

Re: Cubic Spline? Anyone?

Posted: Mon Aug 24, 2020 9:14 pm
by trevix
Gasp!
Not very helpful to me.
I need some LC code

Re: Cubic Spline? Anyone?

Posted: Mon Aug 24, 2020 9:50 pm
by richmond62
Actually that Wikipedia page explains things in a comparatively comprehensible fashion.

Re: Cubic Spline? Anyone?

Posted: Tue Nov 24, 2020 12:55 pm
by stam
richmond62 wrote:
Mon Aug 24, 2020 7:51 pm
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.'
I like to think I'm OK at maths but that wikipedia page made my eyes water... :shock: :shock:


A cursory search found this: livecode-bezier-line-demo
Untested and don't know if it will help, but worth a look...

Re: Cubic Spline? Anyone?

Posted: Tue Nov 24, 2020 4:19 pm
by Klaus
stam wrote:
Tue Nov 24, 2020 12:55 pm
I like to think I'm OK at maths but that wikipedia page made my eyes water... :shock: :shock:
I was alway weak at math, and yes, I immediately closed the page above when I saw it!
stam wrote:
Tue Nov 24, 2020 12:55 pm
A cursor search found this: livecode-bezier-line-demo
Untested and don't know if it will help, but worth a look...
Ah, one of Scott Rossis stacks, can't be wrong and will surely look gorgeous! :-)

Re: Cubic Spline? Anyone?

Posted: Tue Jun 14, 2022 12:33 pm
by opn
I'm looking for that function to smooth the points of a curve graphic!

Re: Cubic Spline? Anyone?

Posted: Tue Jun 14, 2022 2:27 pm
by richmond62
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.

Re: Cubic Spline? Anyone?

Posted: Tue Jun 14, 2022 3:14 pm
by richmond62
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

Code: Select all

before mouseDown
handler before . . .

Re: Cubic Spline? Anyone?

Posted: Tue Jun 14, 2022 5:40 pm
by stam
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!