Пример #1
0
 public FingerprintDataBase_S(Dictionary<PointF, Fingerprint> dict, Map map) : base(dict, map) { }
Пример #2
0
 public FingerprintDataBase(Dictionary<PointF, Dictionary<Fingerprint_Name, Fingerprint>> dict, Map map)
 {
     this.loc_fingerprint_dict = dict;
     this.map = map;
 }
Пример #3
0
 /// <summary>
 /// 接收一个波束,并更新接收机参数,只有与接收频率相同的波束才会产生影响
 /// </summary>
 /// <param name="ray"></param>
 public void AcceptRay(Ray ray, Map map)
 {
     if(ray.CenterFrequency == this.CenterFrequency)
     {
         this.rays.Add(ray);
         this.total_power += ray.FadedPower(map.MeterPixelRatio) * this.Gain;
     }
 }
Пример #4
0
 public Map(Map other)
 {
     this.scatters = other.scatters;
     this.transmitters = other.transmitters;
     this.receivers = other.receivers;
     this.image = other.image;
     this.ray_power_threshold = other.ray_power_threshold;
     this.meter_pixel_ratio = other.meter_pixel_ratio;
     this.grid_on = other.grid_on;
     this.grid_width = other.grid_width;
     this.grid_points = other.grid_points;
 }
Пример #5
0
 public VizRPS(Map map)
 {
     if (map == null)
         throw new ArgumentNullException("map");
     this.map = map;
 }
Пример #6
0
 /// <summary>
 /// 根据所在地图更新波束(完成一次碰撞的结算)
 /// </summary>
 /// <param name="map">所在地图</param>
 /// <param name="sink">返回被接收的接收机,若没被接收则返回null</param>
 /// <returns>若生命周期结束(被接收 || 强度过低 || 射出地图边界)则返回true,否则返回false</returns>
 public bool Update(Map map, out Receiver sink)
 {
     double len2 = Math.Pow(map.Size.Width, 2) + Math.Pow(map.Size.Height, 2);
     double[] vector = new double[] { Math.Cos(this.CurrentDirection), Math.Sin(this.CurrentDirection) };
     vector[0] *= len2;
     vector[1] *= len2;
     Point dest_pt = new Point((int)Math.Round(this.CurrentLocation.X + vector[0]), 
                               (int)Math.Round(this.CurrentLocation.Y - vector[1]));
     LineSegment shoot_seg = new LineSegment(this.CurrentLocation, dest_pt);
     if (this.path_segs.Count > 0)   //至少要反射一次才能被接收机接收
     {
         List<Receiver> tmp_rec = new List<Receiver>();
         foreach (Receiver rec in map.Receivers)
         {
             if (map.IsLOS(this.CurrentLocation, rec.Location))  //若接收机与当前点为视距且在波束宽度内
                 if(new LineSegment(this.CurrentLocation, rec.Location).Angle(shoot_seg) < this.BeamWidth / 2)
                     tmp_rec.Add(rec);
         }
         if(tmp_rec.Count > 0)
         {
             sink = tmp_rec[new Random().Next(tmp_rec.Count)];   //随机被一满足条件的接收机接收
             LineSegment l = new LineSegment(this.CurrentLocation, sink.Location);
             this.path_segs.Add(l);
             this.current_direction = this.path_segs.Last().DirectionRadian;
             return true;
         }
     }
     Point? tmp_pt = null;
     LineSegment tmp_seg = null;
     SCATTER_SEG_DIRECTION tmp_dir = SCATTER_SEG_DIRECTION.CLOCKWISE;
     double tmp_dc = 0;
     tmp_pt = map.GetClosestReflectionPoint(shoot_seg, out tmp_seg, out tmp_dir, out tmp_dc);
     if(tmp_pt == null)  //无碰撞,射出地图边界
     {
         sink = null;
         this.path_segs.Add(shoot_seg);
         this.current_direction = shoot_seg.DirectionRadian;
         return true;
     }
     else    //发生碰撞
     {
         LineSegment l = new LineSegment(this.CurrentLocation, tmp_pt.Value);
         this.path_segs.Add(l);
         double reflect_angle = RadioPropagationModel.SpecularReflection(shoot_seg, tmp_seg, tmp_dir);
         if(tmp_pt == tmp_seg.HeadPosition || tmp_pt == tmp_seg.TailPosition)
         {
             reflect_angle = shoot_seg.DirectionRadian + Math.PI;
             if(reflect_angle > Math.PI * 2)
                 reflect_angle -= Math.PI * 2;
         }
         this.current_direction = RadioPropagationModel.DiffuseReflection(reflect_angle);
         this.power = RadioPropagationModel.ReflectionLoss(this.UnfadedPower, shoot_seg, tmp_seg, tmp_dc);
         sink = null;
         return this.FadedPower(map.MeterPixelRatio) < map.RayPowerThreshold * this.InitPower;    //若碰撞后强度过低则返回true结束,否则返回false,可以继续Update
     }
 }