Vec3

data class Vec3(x: Float, y: Float, z: Float) : Vec

3D vector with coordinates (x, y, z).

Can be used to specify RGB color values.

Constructors

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

Types

Companion
Link copied to clipboard
object Companion

Functions

cross
Link copied to clipboard
infix fun cross(other: Vec3): Vec3

Calculates cross product of this vector and the other vector.

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

Divides this vector by the specified number.

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

Calculates dot product of this vector and the other vector.

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

Subtracts the other vector from this vector.

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

Adds the other vector to this vector.

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

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.

toVec2
Link copied to clipboard
fun toVec2(): Vec2

Returns a 2D vector with x and y coordinates of this vector.

toVec4
Link copied to clipboard
fun toVec4(w: Float = 0.0f): Vec4

Returns a 4D vector with x, y and `z coordinates of this vector and the given w coordinate.

unaryMinus
Link copied to clipboard
operator fun unaryMinus(): Vec3

Returns a vector opposite to this vector.

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

Returns this vector.

Properties

b
Link copied to clipboard
val b: Float

Blue channel of RGB color.

g
Link copied to clipboard
val g: Float

Green channel of RGB color.

r
Link copied to clipboard
val r: Float

Red channel of RGB color.

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