mirror of
https://github.com/patriciogonzalezvivo/thebookofshaders
synced 2024-11-11 13:10:57 +00:00
21 lines
443 B
Markdown
21 lines
443 B
Markdown
## Normalize
|
|
Calculate the unit vector in the same direction as the input vector
|
|
|
|
### Declaration
|
|
```glsl
|
|
float normalize(float x)
|
|
vec2 normalize(vec2 x)
|
|
vec3 normalize(vec3 x)
|
|
vec4 normalize(vec4 x)
|
|
```
|
|
|
|
### Parameters
|
|
```x``` specifies the vector to normalize.
|
|
|
|
### Description
|
|
```normalize()``` returns a vector with the same direction as its parameter, ```x```, but with length 1.
|
|
|
|
### See Also
|
|
|
|
[length()](/glossary/?search=length)
|