public static double CalculateDistance(Point3D firstPoint, Point3D secondPoint) { double distance = 0; // formula: distance3D = Sqrt(Pow(x1-x2) + Pow(y1-y2) + Pow(z1-z2)) distance = Math.Sqrt(Math.Pow(firstPoint.coordX - secondPoint.coordX, 2) + + Math.Pow(firstPoint.coordY - secondPoint.coordY, 2) + + Math.Pow(firstPoint.coordZ - secondPoint.coordZ, 2)); return distance; }
static void Main() { Point3D firstPoint = new Point3D(5, 2, 8); Point3D secondPoint = new Point3D(4, 7, 1); Console.WriteLine("The distance between two points is:{0}", DistanceBtwTwoPoints.CalculateDistance(firstPoint, secondPoint)); Path pathOne = new Path(); pathOne.AddNewPoint(firstPoint); pathOne.AddNewPoint(firstPoint); pathOne.AddNewPoint(secondPoint); PathStorage.SavePath(pathOne); Console.WriteLine(PathStorage.LoadPath()); }
public void AddNewPoint(Point3D point) { pointsStorage.Add(point); }
public void RemoveOnePoint(Point3D noPoint) { pointsStorage.Remove(noPoint); }