clamp01 function

double clamp01(
  1. double val
)

Implementation

double clamp01(double val) => math.min(1.0, math.max(0.0, val));