• R/O
  • SSH
  • HTTPS

wheretrainbuild: Commit


Commit MetaInfo

Revision55 (tree)
Zeit2020-07-13 13:29:52
Autordangerouswoo

Log Message

(empty log message)

Ändern Zusammenfassung

Diff

--- WhereTrainBuild/AI/LineWalker.cs (revision 54)
+++ WhereTrainBuild/AI/LineWalker.cs (revision 55)
@@ -72,11 +72,35 @@
7272
7373 protected class ThreshPack
7474 {
75+ /// <summary>
76+ /// 位置
77+ /// </summary>
7578 public latlontool.latlng Position ;
79+ /// <summary>
80+ /// 方向
81+ /// </summary>
7682 public PointF Vector;
83+ /// <summary>
84+ /// 角度差
85+ /// </summary>
7786 public double AngleDiff;
87+ /// <summary>
88+ /// 距離
89+ /// </summary>
7890 public double Distance;
91+ /// <summary>
92+ /// 距離差
93+ /// </summary>
7994 public double Diff;
95+
96+ /// <summary>
97+ /// 判定用ウエイト
98+ /// </summary>
99+ /// <returns></returns>
100+ public double Weight()
101+ {
102+ return Math.Abs(AngleDiff) * 0.8 + Diff * 1.1;
103+ }
80104 }
81105
82106 /// <summary>
@@ -307,7 +331,7 @@
307331 {
308332 var findlist = new List<ThreshPack>();
309333
310- for (float fDistance = 2.0f; fDistance <= 60.0f; fDistance += 2.0f)
334+ for (float fDistance = 2.0f; fDistance <= 75.0f; fDistance += 2.0f)
311335 {
312336 double dDeltaR = 1 / fDistance * 2.0;
313337 if (dDeltaR < 0.3)
@@ -334,7 +358,7 @@
334358 lock (findlist)
335359 {
336360 //発見
337- findlist.Add(new ThreshPack() { Position = result.next, Vector = testvector, AngleDiff = iD, Distance = fDistance });
361+ findlist.Add(new ThreshPack() { Position = result.next, Vector = testvector, AngleDiff = iD, Distance = fDistance, Diff = latlontool.calcS(result.next, nlatlng) });
338362 }
339363 }
340364 });
@@ -391,8 +415,8 @@
391415 linestable.Add(pppp[pppp.Length / 2]);
392416 }
393417
394- //角度差分の少ない候補とする
395- var finalpacklist = linestable.Where(lp => Math.Abs(lp.AngleDiff) == linestable.Min(lpp => Math.Abs(lpp.AngleDiff))).ToArray();
418+ //差分の少ない候補とする
419+ var finalpacklist = linestable.Where(lp => lp.Weight() == linestable.Min(lpp => lpp.Weight())).ToArray();
396420 var next = finalpacklist[finalpacklist.Length / 2];
397421 m_walking++;
398422 walkinglist.Add(next.Position);
Show on old repository browser