private string filePath = "setting.ini"; //初始化文件地址 public RadarG4(RadarSetting setting, string path = "setting.ini", int rate = 15, int freq = 15, bool reversion = false) { sampleRate = rate; scanFreq = freq; ifReversion = reversion; filePath = path; radarPosition = setting.position; radarArea = setting.area; connectType = setting.type; capacity = setting.capacity; createNewRadar(); xyData = new XYPoint[capacity]; dataNumber = 0; }
public void update(XYPoint now) //设定鼠标现在位置为xypoint位置,根据信息更新速度加速度等信息。 { TimeSpan span = DateTime.Now - time; float dtime = (float)span.TotalMilliseconds / 1000.0f; time = DateTime.Now; xoldpos = xpos; yoldpos = ypos; xoldspeed = xspeed; yoldspeed = yspeed; xpos = now.x; ypos = now.y; xspeed = (xpos - xoldpos) / dtime; yspeed = (ypos - yoldpos) / dtime; xmaccel = (xspeed - xoldspeed) / dtime; ymaccel = (yspeed - yoldspeed) / dtime; maccel = (float)Math.Sqrt(xmaccel * xmaccel + ymaccel * ymaccel); AntiShaking(dtime); }
public void add(XYPoint point) //将point的值纳入平均计算中 { x = (x * num + point.x) / (num + 1); y = (y * num + point.y) / (num + 1); num++; }
public void set(XYPoint point) { x = point.x; y = point.y; num = 1; }
//获取xy坐标形式的点数据,ptArr为点数组,nPtArr为返回的有效点数量,调用时为点最大数量 public extern static int EAIScreenLd_getLdMap(IntPtr handle, ref XYPoint ptArr, ref int nPtArr);
abstract public bool ifInAreaXY(ref XYPoint point); //判断特定点是否在平面设定范围内