Esempio n. 1
0
 public static void Main()
 {
    // Console.WriteLine(Point3D.Center.ToString());
     Point3D point1 = new Point3D(1, 2, 3);
     Console.WriteLine(point1.ToString());
     
 }
Esempio n. 2
0
        public static double CalculateDistance(Point3D firstOne, Point3D secOndne)
        {
            double distance = Math.Sqrt(
                                        ((firstOne.X - secOndne.X) * (firstOne.X - secOndne.X)) +
                                        ((firstOne.Y - secOndne.Y) * (firstOne.Y - secOndne.Y)) +
                                        ((firstOne.Z - secOndne.Z) * (firstOne.Z - secOndne.Z))
                                        );

            return distance;
        }
Esempio n. 3
0
        public static Path LoadPath(string filePath)
        {
            string regex = @"X: (?<x>-?\d*\.?\d+([eE][-+]?\d+)?); Y: (?<y>-?\d*\.?\d+([eE][-+]?\d+)?); Z: (?<z>-?\d*\.?\d+([eE][-+]?\d+)?)";
            Path path = new Path();
            StreamReader reader = new StreamReader(filePath, Encoding.UTF8);

            using (reader)
            {
                while (!reader.EndOfStream)
                {
                    Match match = Regex.Match(reader.ReadLine(), regex);
                    double x = double.Parse(match.Groups["x"].Value);
                    double y = double.Parse(match.Groups["y"].Value);
                    double z = double.Parse(match.Groups["z"].Value);
                    Point3D point = new Point3D(x, y, z);
                    path.AddPoint(point);
                }
            }

            return path;
        }
Esempio n. 4
0
 public void RemovePoint(Point3D point)
 {
     this.pathStorage.Remove(point);
 }
Esempio n. 5
0
 public void AddPoint(Point3D point)
 {
     this.pathStorage.Add(point);
 }