diff --git a/gradle.properties b/gradle.properties index ac4b02a..3c3aa51 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/linear-algebra/src/main/kotlin/ru/dbotthepony/kommons/vector/ExtraOperators.kt b/linear-algebra/src/main/kotlin/ru/dbotthepony/kommons/vector/ExtraOperators.kt new file mode 100644 index 0000000..dc4c30e --- /dev/null +++ b/linear-algebra/src/main/kotlin/ru/dbotthepony/kommons/vector/ExtraOperators.kt @@ -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)