# tes3vector2⚓︎

A simple pair of floating-point numbers.

## Properties⚓︎

### `x`⚓︎

The first value in the vector.

Returns:

• `result` (number)

### `y`⚓︎

The second value in the vector.

Returns:

• `result` (number)

## Methods⚓︎

### `__tostring`⚓︎

Converts the vector to a string with 2 decimal places.

``````local result = myObject:__tostring()
``````

Returns:

• `result` (string)

### `copy`⚓︎

Creates a copy of the vector.

``````local result = myObject:copy()
``````

Returns:

### `length`⚓︎

Calculates the length of the vector.

``````local result = myObject:length()
``````

Returns:

• `result` (number)

### `normalize`⚓︎

Normalize the vector in-place, or set its components to zero if normalization is not possible. Returns `true` if the vector was successfully normalized.

``````local result = myObject:normalize()
``````

Returns:

• `result` (boolean)

### `normalized`⚓︎

Get a normalized copy of the vector.

``````local result = myObject:normalized()
``````

Returns:

## Functions⚓︎

### `new`⚓︎

Creates a new vector. If no parameters are provided, an empty set will be constructed.

``````local vector = tes3vector2.new(x, y)
``````

Parameters:

• `x` (number): Default: `0`.
• `y` (number): Default: `0`.

Returns:

## Math Operations⚓︎

### Addition (`+`)⚓︎

Left operand type Right operand type Result type Description
tes3vector2 tes3vector2 tes3vector2 Standard vector addition.

### Division (`/`)⚓︎

Left operand type Right operand type Result type Description
tes3vector2 number tes3vector2 Divides the vector by a scalar.

### Multiplication (`*`)⚓︎

Left operand type Right operand type Result type Description
tes3vector2 tes3vector2 tes3vector2 The per-element multiplication of two vectors.
tes3vector2 number tes3vector2 Multiplies the vector by a scalar.

### Subtraction (`-`)⚓︎

Left operand type Right operand type Result type Description
tes3vector2 tes3vector2 tes3vector2 Standard vector subtraction.

Last update: August 25, 2023 10:03:48
Created: August 10, 2021 18:38:47