Exemplo n.º 1
0
        public static Point3D DeSerialize(string pointStr)
        {
            Regex rgx = new Regex(@"X: (.+?) Y: (.+?) Z: (.+?)}");
            MatchCollection matches = rgx.Matches(pointStr);
            var g = (matches[0] as Match).Groups;
            Point3D point = new Point3D(double.Parse(g[1].Value), double.Parse(g[2].Value), double.Parse(g[3].Value));

            return point;
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine(Point3D.StartingPoint.ToString());

            Point3D a = new Point3D( 1, 3, 5.6);
            Point3D b = new Point3D( -1, 3, 5.6);
            Point3D c = new Point3D( 1, -3, 5.6);
            Point3D d = new Point3D( 1, 3, -5.6);

            Paths3D path = new Paths3D(a, b, c, d);
            Console.WriteLine(path.ToString());

            Console.WriteLine(DistanceCalc.CalculateDistance(a, d));

            //Storage tests
            Storage.SavePath(@"../../SavedPaths.txt", false, path);
            Storage.SavePath(@"../../SavedPaths.txt", true, path);

            var loadedList = Storage.LoadPaths(@"../..SavedPaths.txt");
            loadedList.ForEach(p => Console.WriteLine(p.ToString()));
        }
Exemplo n.º 3
0
 public static double CalculateDistance(Point3D a, Point3D b)
 {
     double distance = Math.Sqrt(Math.Pow(b.X - a.X, 2) + Math.Pow(b.Y - a.Y, 2) + Math.Pow(b.Z - a.Z, 2));
     return distance;
 }
Exemplo n.º 4
0
 public void Add(Point3D point)
 {
     this.Paths.Add(point);
 }