Companion

object Companion

Functions

Link copied to clipboard
fun fromList(list: List<Float>): Vec2<Float>
fun fromList(list: List<Int>): Vec2<Int>
fun fromList(list: List<Long>): Vec2<Long>

Returns an instance of Vec2 with the given list of coordinates.

Link copied to clipboard
fun fromPolarCoordinates(distance: Float, angle: Angle<Float>): Vec2<Float>

Returns a 2D vector defined by its polar coordinates: radial distance and angle.

fun <T : Number, Comparable<T>> fromPolarCoordinates(distance: T, angle: Angle<T>, type: KClass<T>): Vec2<T>

Returns a 2D vector defined by its polar coordinates of given type: radial distance and angle.

Link copied to clipboard
inline fun <T : Number, Comparable<T>> nullVector(): Vec2<T>

Returns a null vector.

fun <T : Number, Comparable<T>> nullVector(type: KClass<T>): Vec2<T>

Returns a null vector with coordinates of given type.

Link copied to clipboard
inline fun <T : Number, Comparable<T>> unitX(): Vec2<T>

Returns a standard unit vector in the direction of X axis.

fun <T : Number, Comparable<T>> unitX(type: KClass<T>): Vec2<T>

Returns a standard unit vector in the direction of X axis with coordinates of given type.

Link copied to clipboard
inline fun <T : Number, Comparable<T>> unitY(): Vec2<T>

Returns a standard unit vector in the direction of Y axis.

fun <T : Number, Comparable<T>> unitY(type: KClass<T>): Vec2<T>

Returns a standard unit vector in the direction of Y axis with coordinates of given type.

Properties

Link copied to clipboard

A null vector.

Link copied to clipboard

A standard unit vector in the direction of X axis.

Link copied to clipboard

A standard unit vector in the direction of Y axis.