Vec2

data class Vec2(x: Float, y: Float) : Vec

2D vector with coordinates (x, y).

Can be used to specify texture coordinates in UV mapping.

Constructors

Vec2
Link copied to clipboard
common
fun Vec2(x: Float, y: Float)

Types

Companion
Link copied to clipboard
common
object Companion

Functions

div
Link copied to clipboard
common
operator fun div(number: Float): Vec2
Divides this vector by the specified number.
minus
Link copied to clipboard
common
operator fun minus(other: Vec2): Vec2
Subtracts the other vector from this vector.
plus
Link copied to clipboard
common
operator fun plus(other: Vec2): Vec2
Adds the other vector to this vector.
times
Link copied to clipboard
common
operator fun times(number: Float): Vec2
Multiplies this vector by the specified number.
toFloatArray
Link copied to clipboard
common
open override fun toFloatArray(): FloatArray
Returns an array of coordinates of this vector.
toList
Link copied to clipboard
common
open override fun toList(): List<Float>
Returns a list of coordinates of this vector.
toVec3
Link copied to clipboard
common
fun toVec3(z: Float = 0f): Vec3
Returns a 3D vector with x and y coordinates of this vector and the given z coordinate.
toVec4
Link copied to clipboard
common
fun toVec4(z: Float = 0f, w: Float = 0f): Vec4
Returns a 4D vector with x and y coordinates of this vector and the given z and w coordinates.
unaryMinus
Link copied to clipboard
common
operator fun unaryMinus(): Vec2
Returns a vector opposite to this vector.
unaryPlus
Link copied to clipboard
common
operator fun unaryPlus(): Vec2
Returns this vector.

Properties

u
Link copied to clipboard
common
val u: Float
U coordinate for UV mapping.
v
Link copied to clipboard
common
val v: Float
V coordinate for UV mapping.
x
Link copied to clipboard
common
val x: Float
y
Link copied to clipboard
common
val y: Float