c # reference number and its use for comparing with the following floating point numbers


The project is based on Eye Tracker. Let me explain the idea behind the project to better understand my problem.

I have the hardware from Tobii C Eye Tracker. This eye tracker can output the coordinates of the X, Y I'm looking at. This device is very sensitive. When I look at a point, the Eyetracker sends a lot of different data from coordinates, but within ± 100 Area I found out. Although you are staring at one point, your eyes continue to move and therefore output a lot of data. These many data (floating-point numbers) are then stored in a text file. Now I just need 1 data (X coordinate), which means the 1 point I'm staring at, instead of the many data that's inside it ± 100 Area and move it to a new text file.

I have no idea how to program this.

These are the hover Numbers in the text file.

200
201
198
202
250
278
310
315
360
389
500
568
579
590

When I stare at point 1, the data is 200-300that are within the ± 100 Offer. I want to set this 200 as reference point subtracts with the next number and checks if the resulting value is within 100If this is the case, remove it. The reference point should continue to do this with the following numbers until it is outside the ± 100 Offer. Once outside the 100 Area, now is the number 310, then this number is now the next reference point and do the same and subtract with the following numbers and see if the resulting value is inside 100, Once outside the 100 Area is the next number 500Well, that's the new reference point, and do the same thing. That is my goal. In simpler terms, the reference points should be moved to a new file.

This is my code that retrieves the view coordinates and saves them in a text file.

    using system;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Tobii.Interaction;

Namespace ConsoleApp1
{

Class program
{

private static void programintro ()
{
Console.WriteLine ("Press any key to start");
}
public static void Main (string[] arguments)
{

programintro ();
Console.ReadKey ();
double current X = 0.0;
Double current Y = 0.0;
double timeStampCurrent = 0.0;
double diffX = 0.0;
Double delta = 0.0;
int counter = 0;
var host = new host ();
host.EnableConnection ();
var gazePointDataStream = host.Streams.CreateGazePointDataStream ();
gazePointDataStream.GazePoint ((gazePointX, gazePointY, timestamp) =>

{
diffX = gazePointX - currentX;
diffY = gazePointY - currentY;
currentX = gazePointX;
currentY = gazePointY;
timeStampCurrent = timestamp;
if (diffX> 100 || diffX <= -100 || diffY >= 100 || diffY <= -100)
{
counter ++;
using (StreamWriter writer = new StreamWriter ("C: \ user \ student \ Desktop \ FYP 2019 \ ConsoleApp1 \ ConsoleApp1 \ Data \ TextFile1.txt", true))
{
writer.WriteLine ("Recorded Data" + Counter + " n ========================================================= ======================================= == ============================================================================================================================= Data collected at {2}, currentX,
writer.WriteLine ("========================================= ====================================== === ============= ");
}
Console.WriteLine ("Recorded Data" + Counter + " n ============================================ ======================================= == ============================================================================================================================= Data collected at {2}, currentX,
Console.WriteLine ("========================================== ====================================== === ============= ");
}
});
//host.DisableConnection ();
while (true)
{
if (counter <10)
{
continue;
}
otherwise
{

Environment.Exit (0);

}
}

Now my question is how do I code to read the text file and set a
Reference number and subtracts with the next number and check
if the resulting value is within 100 and have a new reference number, though
it outside the ± 100 Offer. These reference numbers are then stored in
a new text file.

If there is a code sample, I'll create a new program and save it there and test it first.