2015-04-18 14:41:34 +00:00
|
|
|
## Normalize
|
2017-12-07 08:28:02 +00:00
|
|
|
Calculate the unit vector in the same direction as the input vector
|
2015-04-18 14:41:34 +00:00
|
|
|
|
|
|
|
### Declaration
|
|
|
|
```glsl
|
|
|
|
float normalize(float x)
|
|
|
|
vec2 normalize(vec2 x)
|
|
|
|
vec3 normalize(vec3 x)
|
|
|
|
vec4 normalize(vec4 x)
|
|
|
|
```
|
|
|
|
|
|
|
|
### Parameters
|
2017-12-07 08:28:02 +00:00
|
|
|
```x``` specifies the vector to normalize.
|
2015-04-18 14:41:34 +00:00
|
|
|
|
|
|
|
### Description
|
2017-12-07 08:28:02 +00:00
|
|
|
```normalize()``` returns a vector with the same direction as its parameter, ```x```, but with length 1.
|
2015-04-18 14:41:34 +00:00
|
|
|
|
|
|
|
### See Also
|
|
|
|
|
2017-08-19 10:11:58 +00:00
|
|
|
[length()](/glossary/?search=length)
|