Vector2

class Vector2

Represents a vector2.

Constructors

Link copied to clipboard
constructor(x: Float, y: Float)

Creates a new Vector2 instance with the specified x, y components.

constructor(value: Float)

Initializes a Vector2 instance with a single float value.

constructor(other: Vector2)

Initializes a Vector2 instance from another Vector2 instance.

constructor(other: Vector3)

Initializes a Vector2 instance from a Vector3 instance's x and y.

Types

Link copied to clipboard
object Companion

The companion object of Vector2.

Properties

Link copied to clipboard
val x: Float

The x position of the Vector2.

Link copied to clipboard
val y: Float

The x position of the Vector2.

Functions

Link copied to clipboard
operator fun dec(): Vector2

Overloads the unary decrement operator (--).

Link copied to clipboard
operator fun div(other: Vector2): Vector2

Divides this Vector2 instance by another Vector2 instance.

operator fun div(scalar: Float): Vector2

Divides this Vector2 instance by a scalar.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
operator fun inc(): Vector2

Overloads the unary increment operator (++).

Link copied to clipboard
fun isFinite(): Boolean

Checks if the value of the Vector2 instance is finite.

Link copied to clipboard
fun length(): Float

Gets the length of the Vector2 instance.

Link copied to clipboard
operator fun minus(other: Vector2): Vector2

Subtracts another Vector2 instance from this Vector2 instance.

Link copied to clipboard

Normalizes the Vector2 instance.

Link copied to clipboard
operator fun plus(other: Vector2): Vector2

Adds another Vector2 instance to this Vector2 instance.

Link copied to clipboard
operator fun times(other: Vector2): Vector2

Multiplies this Vector2 instance by another Vector2 instance.

operator fun times(scalar: Float): Vector2

Multiplies this Vector2 instance by a scalar.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
operator fun unaryMinus(): Vector2

Returns the negation of this Vector2 instance, changing (x, y) to (-x, -y).