Пример #1
0
        public static double GetDistance(TimePoint timePoint1, TimePoint timePoint2)
        {
            var pos1 = new UtmPosition(timePoint1.Position.Longitude, timePoint1.Position.Latitude);
            var pos2 = new UtmPosition(timePoint2.Position.Longitude, timePoint2.Position.Latitude);

            if (pos2.Zone != pos1.Zone)
            {
                pos2 = pos2.Transform(pos1.Zone);
            }

            return(Math.Sqrt(Math.Pow(pos1.Easting - pos2.Easting, 2) + Math.Pow(pos1.Northing - pos2.Northing, 2)));
        }
Пример #2
0
        private double GetLength()
        {
            double    length    = 0.0;
            TimePoint lastPoint = null;

            foreach (var point in Points)
            {
                if (lastPoint == null)
                {
                    lastPoint = point;
                }
                else
                {
                    length   += lastPoint.Position.DistanceTo(point.Position);
                    lastPoint = point;
                }
            }

            return(length);
        }
Пример #3
0
 public static TimeSpan GetTimeDifference(TimePoint to, TimePoint from)
 {
     return(to.TimeUtc.Subtract(from.TimeUtc));
 }