Commit 3c5463a0 authored by MichaelZinsmaier's avatar MichaelZinsmaier

fixed the saddle issue (hopefully as it should be)

parent 2c887a41
......@@ -196,7 +196,7 @@
//insert a point before and after the "real" data point to force the line
//to have a max,min at the data point however only if it is a lowest or highest point of the
//curve => avoid saddles
var neigh = curvedLinesOptions.fitPointDist;
var fpDist = curvedLinesOptions.fitPointDist;
for (var i = 0; i < points.length; i += ps) {
......@@ -205,25 +205,28 @@
curX = i;
curY = i + yPos;
//smooth front
front[X] = points[curX] - 0.1;
if (i >= ps) {
front[Y] = points[curY - ps] * neigh + points[curY] * (1 - neigh);
} else {
//add point to front
front[X] = points[curX] - fpDist;
front[Y] = points[curY];
}
//smooth back
back[X] = points[curX] + 0.1;
if ((i + ps) < points.length) {
back[Y] = points[curY + ps] * neigh + points[curY] * (1 - neigh);
} else {
//add point to back
back[X] = points[curX] + fpDist;
back[Y] = points[curY];
//get points (front and back) Y value for saddle test
var frontPointY = points[curY];
var backPointY = points[curY];
if (i >= ps) {
frontPointY = points[curY - ps];
}
if ((i + ps) < points.length) {
backPointY = points[curY + ps];
}
//test for a saddle
if ((front[Y] <= points[curY] && back[Y] <= points[curY]) || //max or partial horizontal
(front[Y] >= points[curY] && back[Y] >= points[curY])) {//min or partial horizontal
if ((frontPointY <= points[curY] && backPointY <= points[curY]) || //max or partial horizontal
(frontPointY >= points[curY] && backPointY >= points[curY])) {//min or partial horizontal
//add curve points
xdata[j] = front[X];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment