00001 using System;
00002 using System.Collections.Generic;
00003 using System.Linq;
00004 using System.Text;
00005 using UtmConvert;
00006
00007 namespace system_controller {
00008 class VectorCalculator {
00009
00010 UtmPoint _startPoint;
00011
00012 public VectorCalculator(UtmPoint startPoint) {
00013 _startPoint = new UtmPoint();
00014 _startPoint = startPoint;
00015 }
00016
00017 public UtmPoint getPointFromVector(UtmPoint pt, double distance, double heading) {
00018
00019
00020
00021
00022
00023
00024
00025 double x = Math.Cos(ConvertDegRad.getRadians(heading)) * distance;
00026 double y = Math.Sin(ConvertDegRad.getRadians(heading)) * distance;
00027 pt.Point.X += x;
00028 pt.Point.Y += y;
00029 pt.Note = "Generated by vector calculator.";
00030 pt.Handle = DateTime.Now.ToString();
00031 return pt;
00032 }
00033
00034
00035
00036
00037 public UtmPoint getVectorAdditionPoint(List<UtmPoint> pts) {
00038 double x = _startPoint.Point.X;
00039 double y = _startPoint.Point.Y;
00040 foreach (UtmPoint p in pts) {
00041 x += p.Point.X;
00042 y += p.Point.Y;
00043 }
00044 UtmPoint pt = new UtmPoint(new Point(x, y)
00045 , _startPoint.Zone
00046 , "Generated by vector calculator."
00047 , DateTime.Now.ToString());
00048 return pt;
00049
00050 }
00051 }
00052 }