package me.eater.threedom.utils.joml import org.joml.Matrix4d import org.joml.Matrix4dc import org.joml.Vector3d import org.joml.Vector3dc fun Matrix4dc.setTranslation(x: T, y: T, z: T): Matrix4d = Matrix4d(this).setTranslation(x.toDouble(), y.toDouble(), z.toDouble()) val Matrix4dc.translation: Vector3d get() = getTranslation(Vector3d()) fun Matrix4dc.mutable(): Matrix4d = if (this is Matrix4d) this else Matrix4d(this) operator fun Matrix4dc.times(rhs: Matrix4dc) = mul(rhs, Matrix4d()) operator fun Matrix4d.times(rhs: Matrix4dc) = mul(rhs) @Suppress("FunctionName") fun Vector3d(x: Number, y: Number, z: Number) = Vector3d(x.toDouble(), y.toDouble(), z.toDouble()) operator fun Vector3dc.compareTo(rhs: Vector3dc): Int { for (i in 0 until 3) { val c = this[i].compareTo(rhs[i]) if (c != 0) { return c } } return 0 }