public static double CalculateDistance(Point3D pointX, Point3D pointY) { double distance = Math.Sqrt((pointX.X - pointY.X) * (pointX.X - pointY.X) + (pointX.Y - pointY.Y) * (pointX.Y - pointY.Y) + (pointX.Z - pointY.Z) * (pointX.Z - pointY.Z)); return distance; }
public static void Load(string filePath) { try { using (StreamReader reader = new StreamReader(filePath)) { string line = reader.ReadLine(); while (line != null) { double x = 0; double y = 0; double z = 0; string[] readPoints = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); x = double.Parse(readPoints[0]); y = double.Parse(readPoints[1]); z = double.Parse(readPoints[2]); Point3D newPoint = new Point3D(x, y, z); path.AddPoint(newPoint); line = reader.ReadLine(); } } } catch (Exception) { throw new Exception("No access to file!"); } }
public void RemovePoint(Point3D point) { this.pointList.Remove(point); }
public void AddPoint(Point3D point) { this.pointList.Add(point); }
static Point3D() { o = new Point3D(0, 0, 0); }