Apache OpenOffice (AOO) Bugzilla – Issue 13699
Error in spline generation for scatter plot if x values not in order
Last modified: 2013-02-24 21:20:11 UTC
When x values are not in order such as x:{1,2,5,10,8,6} and y:{10,8,6,5,4,1}, the spline curve is discontinous at the maximum x value. The line reverses.
Hi Bjoern, as discussed, pls have a look.
I have attached a document to illustrate the different approaches to splines. In OOo 1.0 (and StarOffice 6.0) we have a point where the spline is not differentiable (it is contiuous, though). I agree, that this is not acceptable for a spline. I suppose the best solution would be a spline which is not necessarily a function, i.e. where you can have more than one point of the curve for one x-value (like MS Excel). For 6.1 the spline algorithm changed (because sometimes parts of or the entire the curve were missing for certain values). Currently it also supports a function only, but this is done by implicit sorting by x-values. Thus you have a real (differentiable) spline curve, but probably not always what you expected. We will change this in OOo 2.0 or later.
Created attachment 6290 [details] Different Spline curves
.
According to the OpenOffice.org roadmap (http://tools.openoffice.org/releases) this issue was retargeted to OOo Later.
*** Issue 21691 has been marked as a duplicate of this issue. ***
*** Issue 62538 has been marked as a duplicate of this issue. ***
*** Issue 78334 has been marked as a duplicate of this issue. ***
I think the problem of the splines is, that it want to make a spline through the next x-value available. So if splines are enabled a "location curve" or a "Ortskurve" is not displayable when a helix should be made. I can not explain better - sorry. Re 0,9786 0,4200 0,8334 -0,5369 -0,4828 0,0451 0,0912 0,0473 0,0334 0,0213 0,0096 0,0063 0,0039 IM 0,0659 0,8537 -0,1372 -0,4167 0,2282 0,2681 0,0800 0,0202 0,0104 0,0047 0,0014 0,0006 0,0002 these data are in the attached RAR and you can edit the "Ortskuve" on Sheet "Versuch" and you see that the spline goes through the x-values in line and not from point to point from the table. http://home1.f1.fhtw-berlin.de/s0509556/miranda/V3_-_Ortskurve.rar Please check soon!
The problem is clear: the algorithm for spline creation is bad: it requires sorted-by-x data.
The attached patch is based on the file Splines.cxx outof CWS chart07 ($Revision: 1.9.12.2 $ last change: $Author: iha $ $Date: 2007/07/10 13:46:20 $) As for BSplines the curve has got parameter. I have not changed anything in the local things in that file, because it is written in a generally way, that can also handle others than natural splines and might be useful later on or in other places. I only changed the way in which this tools are used. There is no obvious way to set the parameters to the curve. I first tried it with using the euclidean distance. The result was not so good, because you get curve loops, if there are single extreme points. Now I use simple adding 1 from point to point. But I'm no mathematic expert and if you know a better way to set the parameters please tell me.
Created attachment 46805 [details] patch to allow unsorted points
Looks great with the patch! It is similar to the Excel splines but not exactly the same. But IMO better. The examples I lookes at seemed a bit more homogenous in OOo.
Created attachment 46817 [details] Some cubic splines created with Excel (screenshots) rendered with the patch
Checked some more examples. They look all similar or better than before. Thanks for the patch!
Please verify in CWS chart07.
looks good -> verified
Seen ok in current master -> closed