diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-10 21:30:31 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-10 21:30:31 +0800 |
commit | e833e1227ee19aa199027e2ca753c22f3f8b4c28 (patch) | |
tree | ad16d05b771f4a930d599234d3e3afb2376f69c3 /features | |
parent | fa3fd389d50ad5dfc9b00f485ae85da28fb96a25 (diff) | |
download | SoopyV2-e833e1227ee19aa199027e2ca753c22f3f8b4c28.tar.gz SoopyV2-e833e1227ee19aa199027e2ca753c22f3f8b4c28.tar.bz2 SoopyV2-e833e1227ee19aa199027e2ca753c22f3f8b4c28.zip |
+ fix potential crash with diana guess's
Diffstat (limited to 'features')
-rw-r--r-- | features/events/index.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/features/events/index.js b/features/events/index.js index 594e56a..312a999 100644 --- a/features/events/index.js +++ b/features/events/index.js @@ -430,6 +430,11 @@ class Events extends Feature { this.distance2 = Math.E / slope - Math.hypot(this.firstParticlePoint[0] - pos.getX(), this.firstParticlePoint[1] - pos.getY(), this.firstParticlePoint[2] - pos.getZ()) // console.log(this.dingIndex + " " + this.dingSlope / this.dingIndex + " " + pitch + " " + (pitch - this.lastDingPitch)) + if (this.distance2 > 1000) { + this.distance2 = undefined + this.guessPoint = undefined + return + } let lineDist = Math.hypot(this.lastParticlePoint2[0] - this.particlePoint[0], this.lastParticlePoint2[1] - this.particlePoint[1], this.lastParticlePoint2[2] - this.particlePoint[2]) let distance = this.distance2 @@ -530,7 +535,7 @@ class Events extends Feature { let ySpeed = (this.locs[this.locs.length - 1][1] - this.locs[this.locs.length - 2][1]) / Math.hypot(this.locs[this.locs.length - 1][0] - this.locs[this.locs.length - 2][0], this.locs[this.locs.length - 1][2] - this.locs[this.locs.length - 2][2]) let i = start + 1 - while (distCovered < this.distance2) { + while (distCovered < this.distance2 && i < 10000) { let y = b / (i + a) + c let dist = distMultiplier * (0.06507 * i + 0.259) //This is where the inaccuracy's come from |