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

commonMain.ru.casperix.math.axis_aligned.int32.Dimension3i.kt Maven / Gradle / Ivy

There is a newer version: 1.9.0
Show newest version
package ru.casperix.math.axis_aligned.int32

import ru.casperix.math.axis_aligned.Dimension3
import ru.casperix.math.vector.float32.Vector3f
import ru.casperix.math.vector.int32.Vector3i
import kotlinx.serialization.Serializable

@Serializable
data class Dimension3i(override val width: Int, override val height: Int, override val depth: Int) : Dimension3 {
    fun toVector3i(): Vector3i {
        return Vector3i(width, height, depth)
    }

    fun toVector3f(): Vector3f {
        return Vector3f(width.toFloat(), height.toFloat(), depth.toFloat())
    }

    fun volume(): Int {
        return width * height * depth
    }

    fun get2D(): Dimension2i {
        return Dimension2i(width, height)
    }

    companion object {
        val ZERO = Dimension3i(0, 0, 0)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy