normalize
이 페이지에서

normalize

함수

Returns a unit vector in the same direction as the input, computed by dividing each component by the vector's length.

이름마다 붙은 시그니처와 설명은 커밋 26de7be8의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

declare function normalize<V extends vec2 | vec3 | vec4>(a0: V): V
declare function normalize<T extends Numeric | Vec64Any>(a: T): T

시그니처에는 앰비언트 파일이 스스로 쓰려고 선언한 타입이 나올 수 있습니다. 아래가 그 선언입니다.

Vec64Any
type Vec64Any = vec2f64 | vec3f64 | vec4f64
Numeric
type Numeric = number | vec2 | vec3 | vec4 | vec2i | vec3i | vec4i | vec2u | vec3u | vec4u

매개변수

  • a VT

반환값

VT

설명

The zero vector produces NaN when normalized. Also accepts f64 operands.

대상별 출력

WGSL
normalize(a)
GLSL ES 3.00
normalize(a)

예제

함께 보기

이 페이지 편집 문제 보고