Vec3

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

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

Can be used to specify RGB color values.

Constructors

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

Types

Link copied to clipboard
object Companion

Functions

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

Calculates cross product of this vector and the other vector.

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

Divides this vector by the specified number.

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

Calculates dot product of this vector and the other vector.

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

Subtracts the other vector from this vector.

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

Adds the other vector to this vector.

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

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 toVec2(): Vec2

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

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.

Link copied to clipboard
operator fun unaryMinus(): Vec3

Returns a vector opposite to this vector.

Link copied to clipboard
operator fun unaryPlus(): Vec3

Returns this vector.

Properties

Link copied to clipboard
val b: Float

Blue channel of RGB color.

Link copied to clipboard
val g: Float

Green channel of RGB color.

Link copied to clipboard
val r: Float

Red channel of RGB color.

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