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
fun Vec2(x: Float, y: Float)

Types

Companion
Link copied to clipboard
object Companion

Functions

div
Link copied to clipboard
operator fun div(number: Float): Vec2

Divides this vector by the specified number.

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

Subtracts the other vector from this vector.

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

Adds the other vector to this vector.

times
Link copied to clipboard
operator fun times(number: Float): Vec2

Multiplies this vector by the specified number.

toFloatArray
Link copied to clipboard
open override fun toFloatArray(): FloatArray

Returns an array of coordinates of this vector.

toList
Link copied to clipboard
open override fun toList(): List<Float>

Returns a list of coordinates of this vector.

toVec3
Link copied to clipboard
fun toVec3(z: Float = 0.0f): Vec3

Returns a 3D vector with x and y coordinates of this vector and the given z coordinate.

toVec4
Link copied to clipboard
fun toVec4(z: Float = 0.0f, w: Float = 0.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
operator fun unaryMinus(): Vec2

Returns a vector opposite to this vector.

unaryPlus
Link copied to clipboard
operator fun unaryPlus(): Vec2

Returns this vector.

Properties

u
Link copied to clipboard
val u: Float

U coordinate for UV mapping.

v
Link copied to clipboard
val v: Float

V coordinate for UV mapping.

x
Link copied to clipboard
val x: Float
y
Link copied to clipboard
val y: Float