0

I am new to coding and have a program that produces 1000 3d points into a txt file for a scatter plot in which I lay an elipsoid over it. I need to perform an ellipsoid equation that reads all of those points into a loop that will give me the percentage at the end of how many points lie in the ellipsoid.

How do I read a large txt file directly into a loop with a equation?

the equation I need it read into is if (x/2)^2+(y/2)^2+(z/1)^2 < 1 then it is in the ellipsoid.

Any help is appreciated thank you!

R Rogers
  • 9
  • 2

1 Answers1

0

Can you share your format from the text file? It's important for the sake of how to filter through the code. I found this snippet at this link: Read line by line a large text file and search for a string. I believe it will accomplish what you want so much as the format of your file works.

 using (StreamReader streamReader = new StreamReader(this.MyPath))
    {
         while (streamReader.Peek() > 0)
         {
              string line = streamReader.ReadLine();

              if (line.Contains(Resources.Constants.SpecificString)
              {
                   // Do some action with the string.
              }
         }
    }
  • It is 1000 line with four columns the first column is the line number I do not really need it for the equation the 2n,3rd and 4th are the x, y, and z coordinates of a 3d point. I need to do a calculation on x,y and z for all 1000 rows and at the end know how many lines met the equation standard – R Rogers Sep 10 '18 at 19:35