From 687cb784fe0f58b899949dfa11f03f3cbf99227b Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Sun, 1 Dec 2024 12:22:51 +0100 Subject: [PATCH] Move Float x MaterialColor operator --- src/main/kotlin/MaterialColor.kt | 4 +++- src/main/kotlin/Ray.kt | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/MaterialColor.kt b/src/main/kotlin/MaterialColor.kt index 2aac534..c16ca2d 100644 --- a/src/main/kotlin/MaterialColor.kt +++ b/src/main/kotlin/MaterialColor.kt @@ -11,4 +11,6 @@ data class MaterialColor(val r: Float, val g: Float, val b: Float) { companion object { val Black: MaterialColor = MaterialColor(0f, 0f, 0f) } -} \ No newline at end of file +} + +operator fun Float.times(rhs: MaterialColor) = MaterialColor(this * rhs.r, this * rhs.g, this * rhs.b) diff --git a/src/main/kotlin/Ray.kt b/src/main/kotlin/Ray.kt index 1f06a97..0383cd2 100644 --- a/src/main/kotlin/Ray.kt +++ b/src/main/kotlin/Ray.kt @@ -1,6 +1,5 @@ import java.io.File -operator fun Float.times(rhs: MaterialColor) = MaterialColor(this * rhs.r, this * rhs.g, this * rhs.b) data class Ray(val origin: Point, val direction: Vector) { fun at(t: Float) = origin + t * direction