Color

open class Color(r: Float, g: Float, b: Float, a: Float = 1.0f) : Vec4f

Constructors

Link copied to clipboard
fun Color(other: Color)
Link copied to clipboard
fun Color(r: Float, g: Float, b: Float, a: Float = 1.0f)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun add(other: Vec2f, result: MutableVec2f): MutableVec2f
fun add(other: Vec3f, result: MutableVec3f): MutableVec3f
fun add(other: Vec4f, result: MutableVec4f): MutableVec4f
Link copied to clipboard
fun angleTo(other: Vec2f): Angle
Link copied to clipboard
fun cross(other: Vec3f, result: MutableVec3f): MutableVec3f
Link copied to clipboard
fun distance(other: Vec2f): Float
fun distance(other: Vec3f): Float
fun distance(other: Vec4f): Float
Link copied to clipboard
fun dot(other: Vec2f): Float
fun dot(other: Vec3f): Float
fun dot(other: Vec4f): Float
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Checks vector components for equality (using '==' operator). For better numeric stability consider using isFuzzyEqual.

Link copied to clipboard
fun gamma(gamma: Float, result: MutableColor = MutableColor()): MutableColor
Link copied to clipboard
open operator fun get(i: Int): Float
Link copied to clipboard
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun isFuzzyEqual(other: Vec2f, eps: Float = FUZZY_EQ_F): Boolean

Checks vector components for equality using com.lehaine.littlekt.math.isFuzzyEqual, that is all components must have a difference less or equal eps.

fun isFuzzyEqual(other: Vec3f, eps: Float = FUZZY_EQ_F): Boolean

Checks vector components for equality using com.lehaine.littlekt.math.isFuzzyEqual, that is all components must have a difference less or equal eps.

fun isFuzzyEqual(other: Vec4f, eps: Float = FUZZY_EQ_F): Boolean

Checks vector components for equality using com.lehaine.littlekt.math.isFuzzyEqual, that is all components must have a difference less or equal eps.

Link copied to clipboard
fun length(): Float
Link copied to clipboard
fun lookAt(forward: Vec3f, up: Vec3f, result: MutableVec4f): MutableVec4f
Link copied to clipboard
fun mix(other: Color, weight: Float, result: MutableColor = MutableColor()): MutableColor
fun mix(other: Vec2f, weight: Float, result: MutableVec2f): MutableVec2f
fun mix(other: Vec3f, weight: Float, result: MutableVec3f): MutableVec3f
fun mix(other: Vec4f, weight: Float, result: MutableVec4f): MutableVec4f
Link copied to clipboard
fun mul(other: Vec2f, result: MutableVec2f): MutableVec2f
fun mul(other: Vec3f, result: MutableVec3f): MutableVec3f
fun mul(other: Vec4f, result: MutableVec4f): MutableVec4f
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun quatMul(otherQuat: Vec4f, result: MutableVec4f): MutableVec4f

Multiplies this vector as a quaternion with another in the form of this * other.

Link copied to clipboard
fun quatMulLeft(otherQuat: Vec4f, result: MutableVec4f): MutableVec4f

Multiplies this vector as a quaternion with another in the form of other * this.

Link copied to clipboard
fun rotate(angle: Angle, result: MutableVec2f): MutableVec2f
fun rotate(angle: Angle, axis: Vec3f, result: MutableVec3f): MutableVec3f
fun rotate(angle: Angle, axisX: Float, axisY: Float, axisZ: Float, result: MutableVec3f): MutableVec3f
Link copied to clipboard
fun scale(factor: Float, result: MutableVec2f): MutableVec2f
fun scale(factor: Float, result: MutableVec3f): MutableVec3f
fun scale(factor: Float, result: MutableVec4f): MutableVec4f
Link copied to clipboard
fun scaleRgb(factor: Float, result: MutableColor = MutableColor()): MutableColor
Link copied to clipboard
fun setLength(length: Float, result: MutableVec2f): MutableVec2f
Link copied to clipboard
fun setSqrLength(sqrLength: Float, result: MutableVec2f): MutableVec2f
Link copied to clipboard
fun sqrDistance(other: Vec2f): Float
fun sqrDistance(other: Vec3f): Float
fun sqrDistance(other: Vec4f): Float
Link copied to clipboard
open override fun sqrLength(): Float
Link copied to clipboard
fun subtract(other: Vec2f, result: MutableVec2f): MutableVec2f
fun subtract(other: Vec3f, result: MutableVec3f): MutableVec3f
fun subtract(other: Vec4f, result: MutableVec4f): MutableVec4f
Link copied to clipboard
operator fun times(other: Vec2f): Float
operator fun times(other: Vec3f): Float
operator fun times(other: Vec4f): Float
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun toVec2(): Vec2f
Link copied to clipboard
fun toVec3(): Vec3f
Link copied to clipboard
fun toVec4(): Vec4f
Link copied to clipboard

Transforms the given vector using this quaternion and outputs the result.

Link copied to clipboard

Properties

Link copied to clipboard
open val a: Float
Link copied to clipboard
open val b: Float
Link copied to clipboard
Link copied to clipboard
open val g: Float
Link copied to clipboard

The pole of the gimbal lock, if any. Postiive (+1) for north pole, negative (-1) for south pole, zero (0) who no gimbal lock.

Link copied to clipboard

The rotation around the x-axis. Requires that this vector / quaternion to be normalized.

Link copied to clipboard
open val r: Float
Link copied to clipboard
val roll: Angle

The rotation around the z-axis. Requires this vector / quaternion to be normalized.

Link copied to clipboard
open val w: Float
Link copied to clipboard
open val x: Float
Link copied to clipboard
open val y: Float
Link copied to clipboard
val yaw: Angle

The rotation around the y-axis. Requires that this vector / quaternion tobe normalized.

Link copied to clipboard
open val z: Float

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
fun Color.abgr(): Int
Link copied to clipboard
fun Vec3f.distanceToEdge(edgeA: Vec3f, edgeB: Vec3f): Float
fun Vec2f.distanceToEdge(edgeA: Vec2f, edgeB: Vec2f): Float
Link copied to clipboard
fun Vec3f.distanceToLine(lineA: Vec3f, lineB: Vec3f): Float
Link copied to clipboard
fun Vec3f.distanceToRay(origin: Vec3f, direction: Vec3f): Float
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Vec3f.nearestPointOnRay(origin: Vec3f, direction: Vec3f, result: MutableVec3f): MutableVec3f
Link copied to clipboard
fun Color.rgba(): Int
Link copied to clipboard
fun Vec3f.sqrDistanceToEdge(edgeA: Vec3f, edgeB: Vec3f): Float
fun Vec2f.sqrDistanceToEdge(edgeA: Vec2f, edgeB: Vec2f): Float
Link copied to clipboard
fun Vec3f.sqrDistanceToLine(lineA: Vec3f, lineB: Vec3f): Float
Link copied to clipboard
fun Vec3f.sqrDistanceToRay(origin: Vec3f, direction: Vec3f): Float
Link copied to clipboard
Link copied to clipboard

Packs the color components into a 32-bit integer with the format ABGR and then converts it to a float. Alpha is compressed from 0-255 to use only even numbers between 0-254 to avoid using float bits in the NaN range. Converting a color to a float and back can be lossy for alpha.

Link copied to clipboard
Link copied to clipboard
fun Vec3f.xy(): Vec2f