⚙️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.


Clone

Method

Returns a copy of this vector instance.

Arguments

None.

Returns

Type

Description

Vec2

The copied vector

Example


Floor

Method

Returns floored variant of this vector.

Arguments

None.

Returns

Type

Description

Vec2

Floored variant.

Example


Ceil

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


LenSqr

Method

Returns squared length of this vector.

circle-info

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


DistSqr

Method

Returns squared distance to another vector.

circle-info

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