Commit 3c5463a0 authored by MichaelZinsmaier's avatar MichaelZinsmaier

fixed the saddle issue (hopefully as it should be)

parent 2c887a41
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
//insert a point before and after the "real" data point to force the line //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 //to have a max,min at the data point however only if it is a lowest or highest point of the
//curve => avoid saddles //curve => avoid saddles
var neigh = curvedLinesOptions.fitPointDist; var fpDist = curvedLinesOptions.fitPointDist;
for (var i = 0; i < points.length; i += ps) { for (var i = 0; i < points.length; i += ps) {
...@@ -205,25 +205,28 @@ ...@@ -205,25 +205,28 @@
curX = i; curX = i;
curY = i + yPos; curY = i + yPos;
//smooth front //add point to front
front[X] = points[curX] - 0.1; front[X] = points[curX] - fpDist;
front[Y] = points[curY];
//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) { if (i >= ps) {
front[Y] = points[curY - ps] * neigh + points[curY] * (1 - neigh); frontPointY = points[curY - ps];
} else {
front[Y] = points[curY];
} }
//smooth back
back[X] = points[curX] + 0.1;
if ((i + ps) < points.length) { if ((i + ps) < points.length) {
back[Y] = points[curY + ps] * neigh + points[curY] * (1 - neigh); backPointY = points[curY + ps];
} else {
back[Y] = points[curY];
} }
//test for a saddle //test for a saddle
if ((front[Y] <= points[curY] && back[Y] <= points[curY]) || //max or partial horizontal if ((frontPointY <= points[curY] && backPointY <= points[curY]) || //max or partial horizontal
(front[Y] >= points[curY] && back[Y] >= points[curY])) {//min or partial horizontal (frontPointY >= points[curY] && backPointY >= points[curY])) {//min or partial horizontal
//add curve points //add curve points
xdata[j] = front[X]; 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