public static float CalcBetweenTwoPoints(Point3D p1, Point3D p2) { float deltaX = p1.X - p2.X; float deltaY = p1.Y - p2.Y; float deltaZ = p1.Z - p2.Z; float distance = (float)Math.Sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ); return distance; }
static Path LoadPathsFromFile(string FullPath, string FileName) { Path newPath = new Path(); using (StreamReader sr = new StreamReader(FullPath+FileName)) { string line = null; while ((line = sr.ReadLine()) != null) { string[] splitted = line.Split(new char[] {','},StringSplitOptions.RemoveEmptyEntries); Point3D newPoint = new Point3D(int.Parse(splitted[0]), int.Parse(splitted[1]), int.Parse(splitted[2])); newPath.AddPoint(newPoint); } } return newPath; }
public void AddPoint(Point3D point) { points.Add(point); }