vector

사용되지 않는 항목 표시

This library implements functionality for the vector type in addition to the built-in primitive operator support. It uses vectors with three components (x, y, and z).

Individual vector components can be accessed using the fields x or X, y or Y, z or Z. Since vector values are immutable, writing to individual components is not supported.

요약

함수

속성

  • Constant vector with all components set to 0.

  • Constant vector with all components set to 1.

함수

create

Creates a new vector with the given component values.

매개 변수

반환

magnitude

Calculates the magnitude of a given vector.

매개 변수

vec: vector

반환

normalize

Computes the normalized version (unit vector) of a given vector.

매개 변수

vec: vector

반환

cross

Computes the cross product of two vectors.

매개 변수

vec1: vector
vec2: vector

반환

Computes the dot product of two vectors.

매개 변수

vec1: vector
vec2: vector

반환

angle

Computes the angle between two vectors in radians. The axis, if specified, is used to determine the sign of the angle.

매개 변수

vec1: vector
vec2: vector
axis: vector

반환

floor

Applies math.floor() to every component of the input vector.

매개 변수

vec: vector

반환

ceil

Applies math.ceil() to every component of the input vector.

매개 변수

vec: vector

반환

Applies math.abs() to every component of the input vector.

매개 변수

vec: vector

반환

sign

Applies math.sign() to every component of the input vector.

매개 변수

vec: vector

반환

clamp

Applies math.clamp() to every component of the input vector.

매개 변수

vec: vector
min: vector
max: vector

반환

Applies math.max() to the corresponding components of the input vectors.

매개 변수

...: vector

반환

Applies math.min() to the corresponding components of the input vectors.

매개 변수

...: vector

반환

속성

zero

Constant vector with all components set to 0.

Constant vector with all components set to 1.