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

Types

Companion
Link copied to clipboard
common
object Companion

Functions

cross
Link copied to clipboard
common
infix fun cross(other: Vec3): Vec3
Calculates cross product of this vector and the other vector.
div
Link copied to clipboard
common
operator fun div(number: Float): Vec3
Divides this vector by the specified number.
dot
Link copied to clipboard
common
infix fun dot(other: Vec3): Float
Calculates dot product of this vector and the other vector.
minus
Link copied to clipboard
common
operator fun minus(other: Vec3): Vec3
Subtracts the other vector from this vector.
plus
Link copied to clipboard
common
operator fun plus(other: Vec3): Vec3
Adds the other vector to this vector.
times
Link copied to clipboard
common
operator fun times(number: Float): Vec3
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.
toVec2
Link copied to clipboard
common
fun toVec2(): Vec2
Returns a 2D vector with x and y coordinates of this vector.
toVec4
Link copied to clipboard
common
fun toVec4(w: Float = 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
common
operator fun unaryMinus(): Vec3
Returns a vector opposite to this vector.
unaryPlus
Link copied to clipboard
common
operator fun unaryPlus(): Vec3
Returns this vector.

Properties

b
Link copied to clipboard
common
val b: Float
Blue channel of RGB color.
g
Link copied to clipboard
common
val g: Float
Green channel of RGB color.
r
Link copied to clipboard
common
val r: Float
Red channel of RGB color.
x
Link copied to clipboard
common
val x: Float
y
Link copied to clipboard
common
val y: Float
z
Link copied to clipboard
common
val z: Float