Skip to content

Commit

Permalink
cesium: improve range-based color mapping using avg and std
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Sep 8, 2023
1 parent b13ce9e commit 97c567f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/cesiumExtra/colorCoderRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export default class ColorCoderRange {
this.lastindex < this.state.messages.RFND.time_boot_ms.length - 1) {
this.lastindex++
}
const color = this.state.messages.RFND.Dist[this.lastindex] / this.maxDist
return new Color(1 - color, 0, color)
const maxDist = Math.min(this.stats.avg + this.stats.std * 3, this.stats.max)
const color = Math.max(Math.min(this.state.messages.RFND.Dist[this.lastindex] / maxDist, 255), 0)
return new Color(255 - color, 255 - color, color)
}
}

0 comments on commit 97c567f

Please sign in to comment.