//Will return true if a Track is in another Track's airspace public bool IsInOtherAirSpace(TrackObject TO1, TrackObject TO2) { double horizontalDistance = CalculateDistance2D(TO1.XCoord, TO2.XCoord, TO1.YCoord, TO2.YCoord); int verticalDistance = CalculateDistance1D(TO1.Altitude, TO2.Altitude); return(horizontalDistance < horizontalSeparation && verticalDistance < verticalSeparation); }
//Returns velocity in whole meters per second public int CalculateVelocity(TrackObject oldTO, TrackObject newTO) { TimeSpan timeDiff = newTO.Timestamp - oldTO.Timestamp; double dist = this.CalculateDistance2D(oldTO.XCoord, newTO.XCoord, oldTO.YCoord, newTO.YCoord); return((int)(dist / (timeDiff.TotalMilliseconds / 1000))); //This will give dist m / timeDiff s }
public int CalculateCourse(TrackObject oldTO, TrackObject newTO) { // angle in degrees var angleDeg = Math.Atan2(-(newTO.YCoord - oldTO.YCoord), newTO.XCoord - oldTO.XCoord) * 180 / Math.PI; angleDeg += 90; if (angleDeg < 0) { angleDeg += 360; } return((int)angleDeg); }
public void SetUp() { trackData = new List <string> { "ATR423", "50000", "50000", "1000", "20151006213456789" }; _uut = new TrackObject(trackData); _uut.Velocity = 10; _uut.Course = 100; _uut.PrettyTimeStamp = "October 6th, 2015, at 21:34:56 and 789 milliseconds"; _tag = "ATR423"; _xCoord = 50000; _yCoord = 50000; _altitude = 1000; _velocity = 10; _course = 100; _prettyTimestamp = "October 6th, 2015, at 21:34:56 and 789 milliseconds"; _timestamp = DateTime.ParseExact("20151006213456789", "yyyyMMddHHmmssfff", System.Globalization.CultureInfo.InvariantCulture); }
public void MakeTrack(object sender, RawTransponderDataEventArgs e) { { trackObjects.Clear(); } foreach (var data in e.TransponderData) //foreach string in the stringlist { var trackData = TransponderParser(data); var track = new TrackObject(trackData) { PrettyTimeStamp = FormatTimestamp(trackData[4]) }; trackObjects.Add(track); } _trackingFiltering.IsTrackInMonitoredAirspace(trackObjects); }