lullaby/modules/input/input_manager.cc
// Clamps the components of the vector between min and max and logs an error if
// they fall outside that range.
Clamps the components of the vector between min and max and logs an error if
they fall outside that range.
Clamps the components of the vector between min and max and logs an error if they fall outside that range .
mathfu::vec2 ClampVec2(const mathfu::vec2& value, float min, float max) {
  if (value.x < min || value.x > max || value.y < min || value.y > max) {
    LOG(ERROR) << "Input outside valid range [" << min << ", " << max << "]";
    return mathfu::vec2(mathfu::Clamp(value.x, min, max),
                        mathfu::Clamp(value.y, min, max));
  }
  return value;
}
mathfu :: vec2 ClampVec2 ( const mathfu :: vec2 & value , float min , float max ) { if ( value . x < min || value . x > max || value . y < min || value . y > max ) { LOG ( ERROR ) << " " << min << " " << max << " " ; return mathfu :: vec2 ( mathfu :: Clamp ( value . x , min , max ) , mathfu :: Clamp ( value . y , min , max ) ) ; } return value ; }
Clamps the components of the vector between min and max and logs an error if
they fall outside that range.
Clamps the components of the vector between min and max and logs an error if they fall outside that range .