コード例 #1
0
ファイル: Program.cs プロジェクト: Gab42/OOP
        static void Main(string[] args)
        {
            var pointA = new Point3D(20.5, 12.8, 6);
            var pointB = new Point3D(-4, 5.5, 50);

            Console.WriteLine($"{DistanceCalculator.CalculateDistance(pointA, pointB):F8}");
        }
コード例 #2
0
ファイル: DistanceCalculator.cs プロジェクト: Gab42/OOP
 public static double CalculateDistance(Point3D pointA, Point3D pointB)
 {
     return Math.Sqrt(
         Math.Pow(pointB.AxisX - pointA.AxisX, 2) +
         Math.Pow(pointB.AxisY - pointA.AxisY, 2) +
         Math.Pow(pointB.AxisZ - pointA.AxisZ, 2));
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: vangelov-i/Fundamentals
        static void Main(string[] args)
        {
            Point3D firstP = new Point3D(0, 0, 0);
            Point3D secondP = new Point3D(1, 2, 3);

            Console.WriteLine("The distance between {0} and {1} is {2}",firstP, secondP, DistanceCalculator.Calculate(firstP,secondP));
        }
コード例 #4
0
 public static double CalculateDistance(Point3D first, Point3D second)
 {
     double result = Math.Sqrt(
       (second.X - first.X) * (second.X - first.X) +
       (second.Y - first.Y) * (second.Y - first.Y) +
       (second.Z - first.Z) * (second.Z - first.Z));
     return result;
 }
コード例 #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Start points:" + Point3D.Start);

            Point3D firstPoint = new Point3D(2, 4, 1);

            Console.WriteLine("Current points:" + firstPoint);
        }
コード例 #6
0
        static void Main(string[] args)
        {
            Point3D point1 = new Point3D(-7, -4, 3);
            Point3D point2 = new Point3D(17, 6, 2.5);

            Console.WriteLine(DistanceCalculator.CalcDistance(point1, point2));
            
        }
コード例 #7
0
        public static double CalcDistance(Point3D point1, Point3D point2) 
        {
            double distance = 0;

            distance = Math.Sqrt((point2.X - point1.X) * (point2.X - point1.X) + (point2.Y - point1.Y) * (point2.Y - point1.Y)
                + (point2.Z - point1.Z) * (point2.Z - point1.Z));

            return distance;
        }
コード例 #8
0
ファイル: 03Paths.cs プロジェクト: Razkolnikow/OOPHomeWorks
 static void Main()
 {
     Point3D point1 = new Point3D(1, 3, 5);
     Point3D point2 = new Point3D(-4, 4.5, -7);
     Point3D point3 = new Point3D(1.2, 10, 12);
     Path3D path = new Path3D(Path3D.CreateSequenceOfPoints(point1, point2, point3));
     string text = path.ToString();
     Storage.SaveToFile(".../.../file.txt",text);
     Storage.LoadFile(".../.../file.txt");            
 }
コード例 #9
0
 static void Main()
 {
     Point3D pointA = new Point3D("pointA", 1.2, 3, 5.6);
     Point3D pointB = new Point3D("pointB", -1.2, 3, 5.6);
     Point3D pointc = new Point3D("pointC", 0, 2, 3);
     //Point3D pointTest = new Point3D();
     Console.WriteLine(pointA.ToString());
     Console.WriteLine(pointB.ToString());
     Console.WriteLine(pointc.ToString());
     Console.WriteLine(DistanceCalculator.GetDistance(pointA, pointB));
 }
コード例 #10
0
        static void Main()
        {
            Point3D pointA = new Point3D();
            Point3D pointB = new Point3D(1, 1, 1);
            double distance = 0;
            Console.WriteLine(pointB);
            Console.WriteLine(Point3D.pointZero);

            distance = DistanceBetweenTwoPoints.CalculateDistance(pointA, pointB);
            Console.WriteLine("The distance between two points is: " + distance);
        }
コード例 #11
0
 public static List<Point3D> Load()
 {
     using (StreamReader reader = new StreamReader("../../loadPath.txt"))
     {
         string line = reader.ReadLine();
         List<Point3D> loadPath = new List<Point3D>();
         while(line != null)
         {
             string[] splitLine = line.Split(new char[] {' ', ','}, StringSplitOptions.RemoveEmptyEntries);
             int xCoord = int.Parse(splitLine[0]);
             int yCoord = int.Parse(splitLine[1]);
             int zCoord = int.Parse(splitLine[2]);
             Point3D point = new Point3D(xCoord, yCoord, zCoord);
             loadPath.Add(point);
             line = reader.ReadLine();
         }
         return loadPath;
     }
 }
コード例 #12
0
 public static double GetDistance(Point3D a, Point3D b)
 {
     double distance = 0; 
     distance= Math.Sqrt(((a.X-b.X) * (a.X-b.X))+ ((a.Y-b.Y) * (a.Y-b.Y))+ ((a.Z-b.Z) * (a.Z-b.Z)));
     return distance;
 }
コード例 #13
0
 static void Main(string[] args)
 {
     Point3D point1 = new Point3D(1, 4, 1);
     Point3D point2 = new Point3D(-4, 10, 2);
     Console.WriteLine(DistanceCalc.CalculateDistance(point1, point2));
 }
コード例 #14
0
ファイル: Program.cs プロジェクト: vangelov-i/Fundamentals
 static void Main(string[] args)
 {
     Point3D test = new Point3D(0, 1, 2);
     Console.WriteLine(test.ToString()); // but the output will be the same without using ".ToString()"
 }
コード例 #15
0
 public void AddPoint(Point3D point)
 {
     this.path.Add(point);
 }
コード例 #16
0
 private static void Main()
 {
     Point3D a = new Point3D(1, 2, 3);
     Console.WriteLine(a);
     Console.WriteLine(Point3D.StartingPoint());
 }
コード例 #17
0
 static Point3D()
 {
     startingPoint = new Point3D("center", 0);
 }
コード例 #18
0
ファイル: Program.cs プロジェクト: Gab42/OOP
 static void Main(string[] args)
 {
     var point = new Point3D(20, 8.5, 11);
     Console.WriteLine(point);
     Console.WriteLine(Point3D.StartingPoint);
 }
コード例 #19
0
ファイル: Test.cs プロジェクト: K-Pavlov/Telerik
 public static void Main()
 {
     Point3D point = new Point3D(3,3,5);
     double distance = Distance.CalculateDistance(Point3D.Zero, point );
     Console.WriteLine(distance);
 }
コード例 #20
0
ファイル: Path.cs プロジェクト: K-Pavlov/Telerik
 public void AddPoint(Point3D point)
 {
     route.Add(point);
 }
コード例 #21
0
 public static double Calculate(Point3D point1, Point3D point2)
 {
     return Math.Sqrt((point1.X - point2.X) * (point1.X - point2.X) +
         (point1.Y - point2.Y) * (point1.Y - point2.Y) +
         (point1.Z - point2.Z) * (point1.Z - point2.Z));
 }
コード例 #22
0
 public static double CalculateDistance(Point3D point1, Point3D point2)
 {
     double result = 0;
     result = Math.Sqrt((point1.x - point2.x) * (point1.x - point2.x) + (point1.y - point2.y)*(point1.y - point2.y) + (point1.z - point2.z)*(point1.z - point2.z));
     return result;
 }
コード例 #23
0
ファイル: Distance.cs プロジェクト: K-Pavlov/Telerik
 public static double CalculateDistance(Point3D point1, Point3D point2)
 {
     return Math.Sqrt(
         Math.Pow(
         point1.x - point2.x, 2) + Math.Pow(point1.y - point2.y, 2) + Math.Pow(point1.z - point2.z, 2));
 }
コード例 #24
0
ファイル: Path3D.cs プロジェクト: vangelov-i/Fundamentals
 public void AddPoint3D(Point3D point3D)
 {
     this.points3D.Add(point3D);
 }
コード例 #25
0
ファイル: 01Point3D.cs プロジェクト: Razkolnikow/OOPHomeWorks
 static void Main()
 {
     Point3D point = new Point3D(3, 5, 6);
     Console.WriteLine(point);
     Console.WriteLine(Point3D.StartingPoint);          
 }