vector

Pokaż przestarzałe

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.

Podsumowanie

Funkcje

Właściwości

  • Constant vector with all components set to 0.

  • Constant vector with all components set to 1.

Funkcje

create

Creates a new vector with the given component values.

Parametry

Zwroty

magnitude

Calculates the magnitude of a given vector.

Parametry

vec: vector

Zwroty

normalize

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

Parametry

vec: vector

Zwroty

cross

Computes the cross product of two vectors.

Parametry

vec1: vector
vec2: vector

Zwroty

Computes the dot product of two vectors.

Parametry

vec1: vector
vec2: vector

Zwroty

angle

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

Parametry

vec1: vector
vec2: vector
axis: vector

Zwroty

floor

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

Parametry

vec: vector

Zwroty

ceil

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

Parametry

vec: vector

Zwroty

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

Parametry

vec: vector

Zwroty

sign

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

Parametry

vec: vector

Zwroty

clamp

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

Parametry

vec: vector
min: vector
max: vector

Zwroty

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

Parametry

...: vector

Zwroty

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

Parametry

...: vector

Zwroty

Właściwości

zero

Constant vector with all components set to 0.

Constant vector with all components set to 1.