Exemplo n.º 1
0
        public static Path LoadFile()
        {
            Path pathInUse = new Path();

            using (loadFile)
            {
                string row = loadFile.ReadLine();

                while (row != null)
                {
                    string[] coords = row.Split();

                    Point3DCoord currentPoint = new Point3DCoord()
                    {
                        X = double.Parse(coords[0]),
                        Y = double.Parse(coords[1]),
                        Z = double.Parse(coords[2]),
                    };

                    pathInUse.InsertPoint(currentPoint);
                    row = loadFile.ReadLine();
                }
            }
            return(pathInUse);
        }
        public static double DistanceCalculation(Point3DCoord firstPoint, Point3DCoord secondPoint)
        {
            double distX = Math.Pow((firstPoint.X - secondPoint.X), 2);
            double distY = Math.Pow((firstPoint.Y - secondPoint.Y), 2);
            double distZ = Math.Pow((firstPoint.Z - secondPoint.Z), 2);

            double totalDist = Math.Sqrt(distX + distY + distZ);

            return(totalDist);
        }
Exemplo n.º 3
0
        static void Main()
        {
            Path         newPath = PathStorage.LoadFile();
            Point3DCoord point   = new Point3DCoord(5, 10, 15);

            newPath.InsertPoint(point);

            foreach (var item in newPath.pathToSequence)
            {
                Console.WriteLine(item.ToString());
            }

            PathStorage.SaveFile(newPath);

            Point3DCoord firstPoint  = new Point3DCoord(1, 1, 2);
            Point3DCoord secondPoint = new Point3DCoord(2, 1, 1);

            Console.WriteLine(CalculateDistance.DistanceCalculation(firstPoint, secondPoint));
        }
Exemplo n.º 4
0
 public void RemovePoint(Point3DCoord pointToRemove)
 {
     pathToSequence.Remove(pointToRemove);
 }
Exemplo n.º 5
0
 public void InsertPoint(Point3DCoord newPoint)
 {
     pathToSequence.Add(newPoint);
 }