โš™๏ธvector

This type is a common 3D vector (x, y, z).

This type supports operations, such as +, -, /, * and ==.

x๏ปฟ

Field

Type: float

X coordinate.

y๏ปฟ

Field

Type: float

Y coordinate.

z๏ปฟ

Field

Type: float

Z coordinate.


__call๏ปฟ

Constructor

Constructs a vector.

Arguments

1. Default vector (0, 0, 0).

None.

2. Single value.

Name

Type

Description

value

float

X and Y coordinates.

3. XYZ values.

Name

Type

Description

x

float

X coordinate.

y

float

Y coordinate.

z

float

Z coordinate.

Returns

Type

Description

vector

Vector.

Example


is_zero๏ปฟ

Method

Returns true if this vector is within tolerance range.

Arguments

Name

Type

Description

tolerance

float

Max allowed tolerance. Defaults to 0.01.

Returns

Type

Description

bool

true if ranges between -tolerance and tolerance.

Example


dist๏ปฟ

Method

Returns distance to another vector.

Arguments

Name

Type

Description

other

vector

Vector to calculate distance against.

Returns

Type

Description

float

Distance to other vector.

Example


dist_sqr๏ปฟ

Method

Returns squared distance to another vector.

This method is de-facto faster than the non-squared variant. Use it, if you need extra performance.

Arguments

Name

Type

Description

other

vector

Vector to calculate distance against.

Returns

Type

Description

float

Squared distance to other vector.

Example


dist_2d๏ปฟ

Method

Returns 2D (only x and y values) distance to another vector.

Arguments

Name

Type

Description

other

vector

Vector to calculate distance against.

Returns

Type

Description

float

Distance to other vector.

Example


dist_2d_sqr๏ปฟ

Method

Returns squared 2D (only x and y values) distance to another vector.

This method is de-facto faster than the non-squared variant. Use it, if you need extra performance.

Arguments

Name

Type

Description

other

vector

Vector to calculate distance against.

Returns

Type

Description

float

Squared distance to other vector.

Example


cross๏ปฟ

Method

Returns a cross product to another vector.

Arguments

Name

Type

Description

other

vector

Vector to calculate cross product against.

Returns

Type

Description

vector

Cross product.

Example


is_valid๏ปฟ

Method

Returns true if all values in this vector are finite.

Arguments

None.

Returns

Type

Description

bool

true if values are finite.

Example


length๏ปฟ

Method

Returns length of this vector.

Arguments

None.

Returns

Type

Description

float

Length of this vector.

Example


length_sqr๏ปฟ

Method

Returns squared length of this vector.

This method is de-facto faster than the non-squared variant. Use it, if you need extra performance.

Arguments

None.

Returns

Type

Description

float

Length of this vector.

Example


length_2d๏ปฟ

Method

Returns 2D length of this vector.

Arguments

None.

Returns

Type

Description

float

Length of this vector.

Example


length_2d_sqr๏ปฟ

Method

Returns squared 2D length of this vector.

This method is de-facto faster than the non-squared variant. Use it, if you need extra performance.

Arguments

None.

Returns

Type

Description

float

Length of this vector.

Example


dot๏ปฟ

Method

Returns dot product of 2 vectors.

Arguments

Name

Type

Description

other

vector

Vector to calculate dot product against.

Returns

Type

Description

float

Dot product.

Example

Last updated