normalize
Function
Returns a unit vector in the same direction as the input, computed by dividing each component by the vector's length.
The signature and the sentence under each name are the compiler's own text at commit 26de7be8.
Syntax
declare function normalize<V extends vec2 | vec3 | vec4>(a0: V): Vdeclare function normalize<T extends Numeric | Vec64Any>(a: T): TA signature may name a type the ambient file declares for its own use. These are those declarations.
Vec64Anytype Vec64Any = vec2f64 | vec3f64 | vec4f64Numerictype Numeric = number | vec2 | vec3 | vec4 | vec2i | vec3i | vec4i | vec2u | vec3u | vec4u
Parameters
-
aVT
Return value
VT
Description
The zero vector produces NaN when normalized. Also accepts f64 operands.
Targets
- WGSL
-
normalize(a) - GLSL ES 3.00
-
normalize(a)