⚙️vec2

__call

Constructor

Creates a new 2D vector instance.

Arguments

1. Default vector (0, 0).

None.

2. Single value.

Name

Type

Description

value

float

X and Y coordinates.

3. XY values.

Name

Type

Description

x

float

X coordinate.

y

float

Y coordinate.

Returns

Type

Description

vec2

New vector.

Example


x

Field

Type: float

X coordinate.


y

Field

Type: float

Y coordinate.


floor

Method

Returns floored variant of this vector.

Arguments

None.

Returns

Type

Description

vec2

Floored variant.

Example


Method

Returns ceiled variant of this vector.

Arguments

None.

Returns

Type

Description

vec2

Ceiled variant.

Example


round

Method

Returns rounded variant of this vector.

Arguments

None.

Returns

Type

Description

vec2

Rounded variant.

Example


len

Method

Returns length of this vector.

Arguments

None.

Returns

Type

Description

float

Length.

Example


len_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.

Example


dist

Method

Returns distance to another vector.

Arguments

Name

Type

Description

other

vec2

Other vector.

Returns

Type

Description

float

Distance.

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

vec2

Other vector.

Returns

Type

Description

float

Distance.

Example

Last updated