public Vector3D[] GetFilteredPosition(Vector3D[] data, int[] time) { Vector3D[] result = new Vector3D[dataManager.DataModelList.Count]; bool[] temp = new bool[dataManager.DataModelList.Count]; data.CopyTo(result, 0); for (int i = 1; i < result.Length - 1; i++) { temp[i] = Vector3D.DotProduct(data[i + 1], data[i - 1]) < 0; } bool isInNoise = false; int index = 0; for (int i = 1; i < result.Length - 1; i++) { //hypothesis: true jitter will not happen between signs, so remove all. if (!isInNoise && temp[i]) { isInNoise = true; index = i; } if (isInNoise && !temp[i]) { isInNoise = false; for (int j = index; j < i; j++) { result[j] = data[index - 1] + (data[i] - data[index - 1]) * (time[j] - time[index - 1]) / (time[i] - time[index - 1]); } } } return result; }