new lighting kinda works

This commit is contained in:
minjaesong
2020-10-25 19:10:48 +09:00
parent 4a0e6393d0
commit 9280a1e4a1
2 changed files with 102 additions and 6 deletions

View File

@@ -59,6 +59,13 @@ data class Point2d(var x: Double, var y: Double) : Cloneable {
fun toDoubleArray() = doubleArrayOf(x, y)
fun apply(transformation: (Double, Double) -> Pair<Double, Double>): Point2d {
val translation = transformation(x, y)
this.x = translation.first
this.y = translation.second
return this
}
}
data class Point2i(var x: Int, var y: Int) {
@@ -79,4 +86,12 @@ data class Point2i(var x: Int, var y: Int) {
operator fun minus(other: Point2i): Point2i {
return Point2i(other.x - this.x, other.y - this.y)
}
fun apply(transformation: (Int, Int) -> Pair<Int, Int>): Point2i {
val translation = transformation(x, y)
this.x = translation.first
this.y = translation.second
return this
}
}