/// <summary> /// Create a Trajectory object with the data found in the given file /// </summary> /// <param name="filepath">the file of which the data should be read</param> /// <returns>a Trajectory object</returns> public Trajectory CreateTrajectoryFromFile(string filepath) { readFromFile(filepath); double t = 0; double previousV = 0; Point3D previousPoint = null; foreach (double[] row in _trackData) { if (row.Length == 0) { continue; } var currentPoint = new Point3D(row[0], row[1], row[2], CoordinateUnits); var metricPoint = currentPoint.ConvertTo(CoordinateUnit.metric); var currentV = row[3]; if (previousPoint != null) { t += previousPoint.DistanceTo(metricPoint) / ((currentV + previousV) / 2); } _trajectoryGenerator.AddDatapoint(metricPoint.X, metricPoint.Y, metricPoint.Z, row[3], row[4], t); previousPoint = currentPoint; previousV = currentV; } Trajectory trajectory = _trajectoryGenerator.GenerateTrajectory(); return(trajectory); }
public void PointConvertToTest() { Point3D test = new Point3D(40555, 406560, 4500, CoordinateUnit.metric); Point3D converted = test.ConvertTo(CoordinateUnit.geographic); Assert.AreEqual(3.73396, converted.X, 0.001); }