Commit bab6fd13 authored by MichaelZinsmaier's avatar MichaelZinsmaier

refactored the smooth saddle implementation into a branch as it may cause...

refactored the smooth saddle implementation into a branch as it may cause problems with some data. Having all min max at data points if fit is set to true seems more important than smoothed saddles
parent fbf3cf7f
...@@ -188,9 +188,6 @@ ...@@ -188,9 +188,6 @@
var xdata = new Array; var xdata = new Array;
var ydata = new Array; var ydata = new Array;
var X = 0;
var Y = yPos;
var curX = -1; var curX = -1;
var curY = -1; var curY = -1;
...@@ -214,62 +211,35 @@ ...@@ -214,62 +211,35 @@
for (var i = 0; i < points.length; i += ps) { for (var i = 0; i < points.length; i += ps) {
var front = new Array; var frontX;
var back = new Array; var backX;
curX = i; curX = i;
curY = i + yPos; curY = i + yPos;
//add point X s //add point X s
front[X] = points[curX] - fpDist; frontX = points[curX] - fpDist;
back[X] = points[curX] + fpDist; backX = points[curX] + fpDist;
var factor = 2; var factor = 2;
while (front[X] == points[curX] || back[X] == points[curX]) { while (frontX == points[curX] || backX == points[curX]) {
//inside the ulp //inside the ulp
front[X] = points[curX] - (fpDist * factor); frontX = points[curX] - (fpDist * factor);
back[X] = points[curX] + (fpDist * factor); backX = points[curX] + (fpDist * factor);
factor++; factor++;
} }
//add point Y s
back[Y] = points[curY];
front[Y] = points[curY];
//add curve points
//get points (front and back) Y value for saddle test xdata[j] = frontX;
var frontPointY = points[curY]; ydata[j] = points[curY];
var backPointY = points[curY]; j++;
if (i >= ps) {
frontPointY = points[curY - ps];
}
if ((i + ps) < points.length) {
backPointY = points[curY + ps];
}
//test for a saddle xdata[j] = points[curX];
if ((frontPointY <= points[curY] && backPointY <= points[curY]) || //max or partial horizontal ydata[j] = points[curY];
(frontPointY >= points[curY] && backPointY >= points[curY])) {//min or partial horizontal j++;
//add curve points
xdata[j] = front[X];
ydata[j] = front[Y];
j++;
xdata[j] = points[curX];
ydata[j] = points[curY];
j++;
xdata[j] = back[X];
ydata[j] = back[Y];
j++;
} else {//saddle
//use original point only
xdata[j] = points[curX];
ydata[j] = points[curY];
j++;
}
xdata[j] = backX;
ydata[j] = points[curY];
j++;
} }
} else { } else {
//just use the datapoints //just use the datapoints
......
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