Add missing extra operators

This commit is contained in:
DBotThePony 2024-02-03 19:17:12 +07:00
parent b20e1fede9
commit 5c1a5b4d43
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 59 additions and 1 deletions
gradle.properties
linear-algebra/src/main/kotlin/ru/dbotthepony/kommons/vector

View File

@ -4,7 +4,7 @@ kotlin.code.style=official
specifyKotlinAsDependency=false
projectGroup=ru.dbotthepony.kommons
projectVersion=1.5.0
projectVersion=1.6.0
guavaDepVersion=33.0.0
gsonDepVersion=2.8.9

View File

@ -0,0 +1,58 @@
package ru.dbotthepony.kommons.vector
operator fun Int.times(value: Vector2i) = value.times(this)
operator fun Int.div(value: Vector2i) = Vector2i(this / value.x, this / value.y)
operator fun Int.times(value: Vector2d) = value.times(this)
operator fun Int.div(value: Vector2d) = Vector2d(this / value.x, this / value.y)
operator fun Int.times(value: Vector2f) = value.times(this)
operator fun Int.div(value: Vector2f) = Vector2f(this / value.x, this / value.y)
operator fun Int.times(value: Vector3i) = value.times(this)
operator fun Int.div(value: Vector3i) = Vector3i(this / value.x, this / value.y, this / value.z)
operator fun Int.times(value: Vector3d) = value.times(this)
operator fun Int.div(value: Vector3d) = Vector3d(this / value.x, this / value.y, this / value.z)
operator fun Int.times(value: Vector3f) = value.times(this)
operator fun Int.div(value: Vector3f) = Vector3f(this / value.x, this / value.y, this / value.z)
operator fun Int.times(value: Vector4i) = value.times(this)
operator fun Int.div(value: Vector4i) = Vector4i(this / value.x, this / value.y, this / value.z)
operator fun Int.times(value: Vector4d) = value.times(this)
operator fun Int.div(value: Vector4d) = Vector4d(this / value.x, this / value.y, this / value.z)
operator fun Int.times(value: Vector4f) = value.times(this)
operator fun Int.div(value: Vector4f) = Vector4f(this / value.x, this / value.y, this / value.z)
operator fun Float.times(value: Vector2i) = value.times(this)
operator fun Float.div(value: Vector2i) = Vector2f(this / value.x, this / value.y)
operator fun Float.times(value: Vector2d) = value.times(this)
operator fun Float.div(value: Vector2d) = Vector2d(this / value.x, this / value.y)
operator fun Float.times(value: Vector2f) = value.times(this)
operator fun Float.div(value: Vector2f) = Vector2f(this / value.x, this / value.y)
operator fun Float.times(value: Vector3i) = value.times(this)
operator fun Float.div(value: Vector3i) = Vector3f(this / value.x, this / value.y, this / value.z)
operator fun Float.times(value: Vector3d) = value.times(this)
operator fun Float.div(value: Vector3d) = Vector3d(this / value.x, this / value.y, this / value.z)
operator fun Float.times(value: Vector3f) = value.times(this)
operator fun Float.div(value: Vector3f) = Vector3f(this / value.x, this / value.y, this / value.z)
operator fun Float.times(value: Vector4i) = value.times(this)
operator fun Float.div(value: Vector4i) = Vector4f(this / value.x, this / value.y, this / value.z)
operator fun Float.times(value: Vector4d) = value.times(this)
operator fun Float.div(value: Vector4d) = Vector4d(this / value.x, this / value.y, this / value.z)
operator fun Float.times(value: Vector4f) = value.times(this)
operator fun Float.div(value: Vector4f) = Vector4f(this / value.x, this / value.y, this / value.z)
operator fun Double.times(value: Vector2i) = value.times(this)
operator fun Double.div(value: Vector2i) = Vector2d(this / value.x, this / value.y)
operator fun Double.times(value: Vector2d) = value.times(this)
operator fun Double.div(value: Vector2d) = Vector2d(this / value.x, this / value.y)
operator fun Double.times(value: Vector2f) = value.times(this)
operator fun Double.div(value: Vector2f) = Vector2d(this / value.x, this / value.y)
operator fun Double.times(value: Vector3i) = value.times(this)
operator fun Double.div(value: Vector3i) = Vector3d(this / value.x, this / value.y, this / value.z)
operator fun Double.times(value: Vector3d) = value.times(this)
operator fun Double.div(value: Vector3d) = Vector3d(this / value.x, this / value.y, this / value.z)
operator fun Double.times(value: Vector3f) = value.times(this)
operator fun Double.div(value: Vector3f) = Vector3d(this / value.x, this / value.y, this / value.z)
operator fun Double.times(value: Vector4i) = value.times(this)
operator fun Double.div(value: Vector4i) = Vector4d(this / value.x, this / value.y, this / value.z)
operator fun Double.times(value: Vector4d) = value.times(this)
operator fun Double.div(value: Vector4d) = Vector4d(this / value.x, this / value.y, this / value.z)
operator fun Double.times(value: Vector4f) = value.times(this)
operator fun Double.div(value: Vector4f) = Vector4d(this / value.x, this / value.y, this / value.z)