diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2020-12-31 14:23:45 +0000 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2020-12-31 14:23:45 +0000 |
| commit | 29e52544d389f88a4af836ae1d82b838ed7a10c7 (patch) | |
| tree | 4c80995e8ed0f5b2bdcc55404d18ee03ed474fd1 /src/main/kotlin/Extensions.kt | |
| parent | 3c3322ef1a7aca3517ff94f723004fb809dec6cd (diff) | |
| download | kotlin-raycaster-29e52544d389f88a4af836ae1d82b838ed7a10c7.tar.xz kotlin-raycaster-29e52544d389f88a4af836ae1d82b838ed7a10c7.zip | |
Fix texture loading. Add log overlay
Diffstat (limited to 'src/main/kotlin/Extensions.kt')
| -rw-r--r-- | src/main/kotlin/Extensions.kt | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/main/kotlin/Extensions.kt b/src/main/kotlin/Extensions.kt index 8c11af1..5678a48 100644 --- a/src/main/kotlin/Extensions.kt +++ b/src/main/kotlin/Extensions.kt @@ -1,11 +1,9 @@ -fun Double.sine(): Double { - return kotlin.math.sin(toRadians(this)) -} +fun Double.toRadians() = this * kotlin.math.PI / 180 -fun Double.cosine(): Double { - return kotlin.math.cos(toRadians(this)) -} +fun Double.sine() = kotlin.math.sin(this.toRadians()) -fun Double.toFlooredInt(): Int { - return kotlin.math.floor(this).toInt() -}
\ No newline at end of file +fun Double.cosine() = kotlin.math.cos(this.toRadians()) + +fun Double.toFlooredInt() = kotlin.math.floor(this).toInt() + +fun Double.toRoundedString() = this.asDynamic().toFixed(2) as String
\ No newline at end of file |