You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Manoylov Andriy eb8d3c5f80 add ukrainian translation 10 months ago
..
README-ua.md add ukrainian translation 10 months ago
README-vi.md Translate glossary section (partly) and swap all/any page 4 years ago
README.md Remove trailing whitespaces 7 years ago

README.md

Clamp

Constrain a value to lie between two further values

Declaration

float clamp(float x, float minVal, float maxVal)  
vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal)  
vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal)  
vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal)

vec2 clamp(vec2 x, float minVal, float maxVal)  
vec3 clamp(vec3 x, float minVal, float maxVal)  
vec4 clamp(vec4 x, float minVal, float maxVal)

Parameters

x specify the value to constrain.

minVal specify the lower end of the range into which to constrain x.

maxVal specify the upper end of the range into which to constrain x.

Description

clamp() returns the value of x constrained to the range minVal to maxVal. The returned value is computed as min(max(x, minVal), maxVal).

See Also

min, abs, max