public static double GetDistance(Point3D firstPoint, Point3D secondPoint) { decimal diffX = (firstPoint.X - secondPoint.X) * (FirstPoint.X - secondPoint.X); decimal diffY = (firstPoint.Y - secondPoint.Y) * (FirstPoint.Y - secondPoint.Y); decimal diffZ = (firstPoint.Z - secondPoint.Z) * (FirstPoint.Z - secondPoint.Z); double result = Math.Sqrt((double)(diffX + diffY + diffZ)); return result; }
static void Main() { Point3D x = new Point3D(1, 1, 1); Point3D y = new Point3D(2, 2, 2); Point3D z = new Point3D(3, 3, 3); Path newPath = new Path(); newPath.AddPoint(x); newPath.AddPoint(y); newPath.AddPoint(z); Console.WriteLine("Path before serialization:"); Console.WriteLine(newPath.ToString()); PathStorage.SavePath(newPath); Path list = PathStorage.LoadPath(); Console.WriteLine("Path after deserialization:"); Console.WriteLine(newPath.ToString()); }
public void AddPoints(Point3D point) { pointsSequence.Add(point); }
public void AddPoint(Point3D point) { this.pathHolder.Add(point); }