thebookofshaders/glossary/min/README.md

28 lines
726 B
Markdown
Raw Normal View History

2015-04-17 18:16:45 +00:00
## Min
Return the lesser of two values
2015-04-18 14:41:34 +00:00
### Declaration
2015-04-17 18:16:45 +00:00
```glsl
float min(float x, float y)
vec2 min(vec2 x, vec2 y)
vec3 min(vec3 x, vec3 y)
vec4 min(vec4 x, vec4 y)
vec2 min(vec2 x, float y)
vec3 min(vec3 x, float y)
vec4 min(vec4 x, float y)
```
### Parameters
2015-04-18 14:41:34 +00:00
```x``` specify the first value to compare.
2015-04-17 18:16:45 +00:00
```y``` specify the second value to compare.
2015-04-17 18:16:45 +00:00
### Description
```min()``` returns the minimum of the two parameters. It returns ```y``` if ```y``` is less than ```x```, otherwise it returns ```x```.
<div class="simpleFunction" data="y = min(x,0.5); "></div>
### See Also
2017-08-19 10:11:58 +00:00
[max](/glossary/?search=max), [abs](/glossary/?search=abs), [clamp](/glossary/?search=clamp), [Chapter 05: Shaping Functions](/05/)