Takes x and scales it from one range to another range.
(module (func (export "map") (param $v f32) (param $min1 f32) (param $max1 f32) (param $min2 f32) (param $max2 f32) (result f32) (f32.add (get_local $min2) (f32.div (f32.mul (f32.sub (get_local $v) (get_local $min1)) (f32.sub (get_local $max2) (get_local $min1)) ) (f32.sub (get_local $max1) (get_local $min1)) ) ) ) )
Last updated 5 years ago
Was this helpful?