예제 #1
0
        static void Main()
        {
            Point3D pointOne = new Point3D(4, 5.2, 6);
            Point3D pointTwo = new Point3D(15, 5, 23);

            Console.WriteLine(PointsIn3D.Distance(pointOne, pointTwo));

            Console.WriteLine("\nTesting ToString\n");

            System.Console.WriteLine(pointOne);

            Console.WriteLine("\nTesting foreach for the Path\n");
            foreach (var item in Path.SequencePoints)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("\nThe items in the Path Storage:\n");

            foreach (var item in PathStorage.StorageComponents)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine("\nTest whatever you want!");
        }
예제 #2
0
        public static double CalculateDistance(Point3D pointOne, Point3D pointTwo)
        {
            double distance = 0;
            distance = Math.Sqrt((pointOne.X - pointTwo.X) * (pointOne.X - pointTwo.X) +
                                (pointOne.Y - pointTwo.Y) * (pointOne.Y - pointTwo.Y) +
                                (pointOne.Z - pointTwo.Z) * (pointOne.Z - pointTwo.Z));

            return distance;
        }
예제 #3
0
        public static double CalculateDistance(Point3D firstPoint, Point3D secondPoint)
        {
           double xDistance = firstPoint.X - secondPoint.X;
           double yDistance = firstPoint.Y - secondPoint.Y;
           double zDistance = firstPoint.Z - secondPoint.Z;
           double distance = Math.Sqrt((xDistance * xDistance) + (yDistance * yDistance) + (zDistance * zDistance));

           return distance; 
        }
예제 #4
0
        public static float CalculateDistance(Point3D point1, Point3D point2)
        {
            float deltaX = point1.X - point2.X;
            float deltaY = point1.Y - point2.Y;
            float deltaZ = point1.Z - point2.Z;

            float distance = (float)Math.Sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);
            return distance;
        }
예제 #5
0
        static PathStorage()
        {
            List<Point3D> currentList = new List<Point3D>();
            StreamReader reader = new StreamReader("..\\..\\Storage.txt");
            string line = reader.ReadLine();

            using (reader)
            {
                while (line != null)
                {

                    string[] currentLine =  line.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
                    Point3D currentPoint = new Point3D(double.Parse(currentLine[0]), double.Parse(currentLine[0]), double.Parse(currentLine[2]));
                    currentList.Add(currentPoint);
                    line = reader.ReadLine();
                }
            }
            PathStorage.storageComponents = currentList;
        }
예제 #6
0
        static void Main()
        {
            //Console.WriteLine(Point3D.O);
            
            //Console.WriteLine(myPoint);
            //double distance = Distance.CalculateDistance(Point3D.O, myPoint);
            //Console.WriteLine(distance);

            var myPoint = new Point3D(3, 5, 7);
            
            Path points = new Path();
            points.AddPoint(new Point3D(2, 5, 7.56789));
            points.AddPoint(myPoint);
            points.AddPoint(Point3D.O);
            PathStorage.StorePath(points, "load.txt");
         
            
            
          
        }
예제 #7
0
 public static Path LoadPath(string filename)
 {
     StreamReader reader = new StreamReader(filename);
     Path result = new Path();
     using (reader)
     {
         string line = "default";
        
         while (line != null)
         {
            line = reader.ReadLine();
            var pointsAsString = line.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < pointsAsString.Length; i++)
            {
                var pointValues = pointsAsString[i].Split("|".ToCharArray()).Select(float.Parse).ToList();
                var currentPoint = new Point3D(pointValues[0], pointValues[1], pointValues[2]);
                result.AddPoint(currentPoint);
            }
         }
     }
     return result;
 }
예제 #8
0
 public void AddPoint(Point3D point)
 {
     points.Add(point);
 }
예제 #9
0
 static Point3D()                        //Problem 2 - add a static property to return the value of Point O
 {
     o = new Point3D();
 }
예제 #10
0
 internal static double CalculateDistance(Point3D one, Point3D two)
 {
     return Math.Sqrt( Math.Pow(one.XCoordinate - two.XCoordinate, 2) + Math.Pow(one.YCoordinate - two.YCoordinate, 2) + Math.Pow(one.ZCoordinate - two.ZCoordinate, 2));
 }
예제 #11
0
 static Point3D()
 {
     o = new Point3D(0, 0, 0);
 }
예제 #12
0
 public static double Calculate(Point3D fisrt, Point3D second)
 {
     return Math.Sqrt(Math.Pow(fisrt.X - second.X, 2) + Math.Pow(fisrt.Y - second.Y, 2) + Math.Pow(fisrt.Z - second.Z, 2));
 }
예제 #13
0
 public static double Calculate(Point3D fisrt, Point3D second)
 {
     return(Math.Sqrt(Math.Pow(fisrt.X - second.X, 2) + Math.Pow(fisrt.Y - second.Y, 2) + Math.Pow(fisrt.Z - second.Z, 2)));
 }
예제 #14
0
 public void AddPoint(Point3D p)
 {
     this.PointsPath.Add(p);
 }
예제 #15
0
 public List<Point3D> AddPoint(Point3D points)
 {
     this.points.Add(new Point3D());
     return this.points;
 }