Vec2

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

2D vector with coordinates (x, y).

Can be used to specify texture coordinates in UV mapping.

Constructors

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

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun atan(): Angle

Returns the arc tangent of value y/x for this vector.

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

Divides this vector by the specified number.

Link copied to clipboard
infix fun dot(other: Vec2): Float

Calculates dot product of this vector and the other vector.

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

Subtracts the other vector from this vector.

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

Adds the other vector to this vector.

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

Multiplies this vector by the specified number.

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

Returns an array of coordinates of this vector.

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

Returns a list of coordinates of this vector.

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.

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.

Link copied to clipboard
operator fun unaryMinus(): Vec2

Returns a vector opposite to this vector.

Link copied to clipboard
operator fun unaryPlus(): Vec2

Returns this vector.

Properties

Link copied to clipboard
val u: Float

U coordinate for UV mapping.

Link copied to clipboard
val v: Float

V coordinate for UV mapping.

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