All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.ru.casperix.math.TransformABCD.kt Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package ru.casperix.math

import ru.casperix.math.quad_matrix.float32.Matrix3f

data class TransformABCD(
    val x: Float,
    val y: Float,
    val a: Float,
    val b: Float,
    val c: Float,
    val d: Float,
) {
    fun toMatrix(): Matrix3f {
        return Matrix3f(
            floatArrayOf(
                a, b, 0f,
                c, d, 0f,
                x, y, 1f,
            )
        )
    }

    companion object {
        val IDENTITY = TransformABCD(0f, 0f, 1f, 0f, 0f, 1f)
        fun from(matrix: Matrix3f) = matrix.run {
            TransformABCD(
                data[6], data[7],
                data[0], data[1],
                data[3], data[4],
            )
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy