• R/O
  • SSH
  • HTTPS

wheretrainbuild: Commit


Commit MetaInfo

Revision50 (tree)
Zeit2020-06-29 22:21:37
Autordangerouswoo

Log Message

(empty log message)

Ändern Zusammenfassung

Diff

--- WhereTrainBuild/AI/LineWalker.cs (revision 49)
+++ WhereTrainBuild/AI/LineWalker.cs (revision 50)
@@ -286,24 +286,37 @@
286286 {
287287 var findlist = new List<ThreshPack>();
288288
289- for (float fDistance = 2.0f; fDistance <= 50.0f; fDistance += 2.0f)
289+ for (float fDistance = 2.0f; fDistance <= 60.0f; fDistance += 2.0f)
290290 {
291- (bool Result, latlontool.latlng next) result;
292-
293291 double dDeltaR = 1 / fDistance * 2.0;
292+ if (dDeltaR < 0.3)
293+ dDeltaR = 0.3;
294294
295+ double dSetaRange = 0.0f;
296+ if( fDistance > 30.0f )
297+ {
298+ dSetaRange = 20.0f * (fDistance - 30.0f) / 30.0f;
299+ }
300+
295301 //とりあえず、前方向をサーチ
296- for (double iD = -40.0; iD <= 40.0; iD += dDeltaR)
302+ List<double> loopsrc = new List<double>();
303+ for (double iD = -40.0 + dSetaRange; iD <= 40.0 - dSetaRange; iD += dDeltaR)
304+ loopsrc.Add(iD);
305+
306+ Parallel.ForEach(loopsrc, (iD) =>
297307 {
298308 var vdo = latlontool.ToRadian(latlontool.ToAngle(Math.Atan2(nvector.Y, nvector.X)) + iD);
299309 var testvector = new PointF((float)Math.Cos(vdo), (float)Math.Sin(vdo));
300- result = Move(nlatlng, testvector, fDistance);
310+ var result = Move(nlatlng, testvector, fDistance);
301311 if (result.Result == true)
302312 {
303- //発見
304- findlist.Add(new ThreshPack() { Position = result.next, Vector = testvector, AngleDiff = iD, Distance = fDistance });
313+ lock (findlist)
314+ {
315+ //発見
316+ findlist.Add(new ThreshPack() { Position = result.next, Vector = testvector, AngleDiff = iD, Distance = fDistance });
317+ }
305318 }
306- }
319+ });
307320 }
308321
309322 if (findlist.Count <= 0)
Show on old repository browser