Skip to main content

SplineInterpolator documentation

6 replies [Last post]
pepe
Offline
Joined: 2003-06-10

Hello.
Reading SplineInterpolator's doc, i see that it references SMIL's spline as "information on how splines are used to interpolate". It is unclear to me if this reference is here as a specification for how splines ought to work/react -that is according to smil-, or a general information about what splines are.
I understand that this is mainly due to my lessen english skills that do not let me understand the full meaning of the sentence, so please pardon me by advance.

Thank you for any enlightenment you might provide.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chet
Offline
Joined: 2003-08-07

Hi,

The purpose of that comment is really for both reasons you state:
- It uses the same model as SMIL, so splines defined this way should react the same way
- The whole topic of spline interpolation can be confusing (at least to those new to the topic of time-interpolation-via-splines, like I was when I wrote that code), so it's good to be able to refer to other sources for more information on the topic.

Hope that helps.

Chet.

pepe
Offline
Joined: 2003-06-10

Thank you. That helped.

I might have misunderstood the smil spec, but if timingFramework splines refer to KeySpline, i would have expected the implementation to be much different.
It looks like SplineInterpolator acts as a constant velocity path following algorithm, which is different from what i understood of the smil spec.
It actually returns Y based on calculations of the length of the curve instead of 'just' returning the Y of projection of the factor on X axis onto the curve.

davidbrowne
Offline
Joined: 2003-06-11

You are correct, pepe. I too was wondering about that. I did a little comparison using the examples in the SMIL reference. Using the numbers given there, and comparing to the current Mozilla implementation, Batik implementation, and the Timing Framework, I get the following tables (the SMIL examples have values going from 10 to 20 over 4 seconds, sampled every second):

[code]
Control points: (0.0, 0.0), (1.0, 1.0)

x SMIL Moz Batik TF
--------------------------------------
0 10 10 10.007 10
0.25 12.5 12.5 12.498 12.5
0.5 15 15 15 15
0.75 17.5 17.5 17.502 17.5
1 20 20 19.993 20

Control points: (0.5, 0.0), (0.5, 1.0)

x SMIL Moz Batik TF
--------------------------------------
0 10 10 10 10
0.25 11 11.059 11.051 11.768
0.5 15 15 15 15
0.75 19 18.941 18.949 18.232
1 20 20 20 20

Control points: (0.0, 0.75), (0.25, 1.0)

x SMIL Moz Batik TF
--------------------------------------
0 10 10 10.689 10
0.25 18 18.102 18.095 14.137
0.5 19.3 19.413 19.415 17.812
0.75 19.8 19.887 19.886 19.635
1 20 20 20 20

Control points: (1.0, 0.0), (0.25, 0.25)

x SMIL Moz Batik TF
--------------------------------------
0 10 10 10 10
0.25 10.1 10.077 10.077 10.276
0.5 10.6 10.644 10.649 13.193
0.75 16.9 16.909 16.912 16.905
1 20 20 19.995 20
[/code]

pepe
Offline
Joined: 2003-06-10

Hello, David.
Those are precise numbers, thanks for the time passed on getting them.
I did not doubt that results were to differ largely, the two algorithms are absolutly not the same thing and cover very different aspects of animation.
Nevertheless, pointing the differences does not solve the problem. As Chet said, the reference to SMIL is there to indicate this is an implementation of the spec.
Two things can be done now: consider the documentation to be changed so that SMIL is there just as a reference of the use of splines, or change implementation.

On an other hand, i'm shocked that the two other implementations only return vaguely correct results.

Message was edited by: pepe
(replaced 'implementations' by 'algorithms')

davidbrowne
Offline
Joined: 2003-06-11

I just checked out the new Scene Graph project. Unfortunately, their Interpolators.getSplineInstance() behaves similarly to the Timing Framework SplineInterpolator (but with slightly different values).

pepe
Offline
Joined: 2003-06-10

So i guess that it means that javaFX also has that behavior.
That is no problem in fact, and everyone should be in-sync just for the sake of congruence.
Main problem is that documentation and implementation differ in TimingFramework. SGP does not say anything about how splines should behave, but i think anyway that its implementation should change as it is not doing what it should.
There might be a global misunderstanding of what differs from a spline path and a spline modifier. It is anyway not a great deal, there just needs to change private code, not architecture of projects.