Example #1
0
 public static double Calculate(Point3D pointOne,Point3D pointTwo)
 {
     double distance = 0;
     double DistOne = Math.Sqrt(Math.Pow((pointOne.PointX - pointTwo.PointX), 2));
     double DistTwo = Math.Sqrt(Math.Pow((pointOne.PointY - pointTwo.PointY), 2));
     double DistThr = Math.Sqrt(Math.Pow((pointOne.PointZ - pointTwo.PointZ), 2));
     distance = DistOne + DistTwo + DistThr;
     return distance;
 }
Example #2
0
 static void Main()
 {
     Point3D point = new Point3D(-25,2,17);
     Point3D start=Point3D.StartingPoint;
     Console.WriteLine(start.ToString());
     double distance = DistanceCalculator.Calculate(start,point);
     Console.WriteLine(point.ToString());
     Console.WriteLine(distance);
     
 }
Example #3
0
 public static List<Point3D> FileReader(string file)
 {
     List<Point3D>Path=new List<Point3D>();
     StreamReader reader = new StreamReader(file);
     List<String>points=new List<String>();
     using (reader)
     {
         string line=reader.ReadLine();
         string pat = "[0-9.]+";
         Regex reg = new Regex(pat);
         
         while (line != null)
         {
             
             string[] separator = {","};
             string[] words = line.Split(separator, StringSplitOptions.RemoveEmptyEntries);
             Point3D tempPoint = new Point3D(double.Parse(words[0]), double.Parse(words[1]), double.Parse(words[2]));
             Path.Add(tempPoint);
             line = reader.ReadLine();
             
         }
     }
     return Path;
 }
Example #4
0
 static Point3D()
 {
     startingPoint = new Point3D(0, 0, 0);
 }