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.