john-science / wanderlust

Wanderlust
http://antineutrino.net/wanderlust/
GNU Lesser General Public License v3.0
1 stars 1 forks source link

Hiking Pace and Time #12

Closed john-science closed 6 years ago

john-science commented 7 years ago

My first stab at a hiking pace/time function in the Player class seems off. Try something more like this:

var timeTraveled = function(distance, elev0, elev1, land_cover) {
  /** Calculate the time it takes for the hiker to travel a given distance. */
  var toblersRule = function(slope) {
    /** Calculate a hiker's pace in minutes per meter
        https://en.wikipedia.org/wiki/Tobler's_hiking_function
     */
    return 0.01 * Math.exp(3.5 * Math.abs(0.05 + slope));
  }

  var pace = toblersRule((elev1 - elev0) / 30.);
  var land_cover_factor = 3 * (land_cover / 100.0);

  return pace * distance * land_cover_factor;
}