コード例 #1
0
        public static double CalculateDistance(Structure3D first, Structure3D second)
        {
            double distance = 0;
            distance = Math.Sqrt(Math.Pow(first.PositionX - second.PositionX, 2) +
                Math.Pow(first.PositionY - first.PositionY, 2) + Math.Pow(first.PositionZ - first.PositionZ, 2));

            return distance;
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: nnaidenov/TelerikAcademy
        static void Main(string[] args)
        {
            Structure3D firstPoint = new Structure3D(1, 2, 3);
            Structure3D secondPoint = new Structure3D(0, 8, 1);

            Path firstPath = new Path();
            firstPath.AddPoint(firstPoint);
            firstPath.AddPoint(secondPoint);

            PathStorage.SavePaths(firstPath);
            List<Path> pathList = PathStorage.ReadPaths();
        }
コード例 #3
0
        public static List<Path> ReadPaths()
        {
            Path readPaths = new Path();
            List<Path> pathsLoaded = new List<Path>();
            string pathRead = "Paths.txt";
            StreamReader reader = new StreamReader(pathRead);

            using (reader)
            {
                string line = reader.ReadLine();
                while (line != null)
                {
                    Structure3D point = new Structure3D();
                    string[] points = line.Split(',');
                    point.PositionX = int.Parse(points[0]);
                    point.PositionY = int.Parse(points[1]);
                    point.PositionZ = int.Parse(points[2]);
                    readPaths.AddPoint(point);
                    line = reader.ReadLine();
                }
                
            }
            return pathsLoaded;
        }
コード例 #4
0
ファイル: Path.cs プロジェクト: nnaidenov/TelerikAcademy
 //Methods
 public void AddPoint(Structure3D point)
 {
     sequenceOfPoints.Add(point);
 }