mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 19:14:05 +09:00
replacing min/max usage with kotlin's
This commit is contained in:
@@ -81,7 +81,7 @@ fun Color.toXYZ(): CIEXYZ = RGB(this).toXYZ()
|
||||
}
|
||||
val step = value.clampOne() * 255f // 0.0 .. 255.0
|
||||
val intStep = step.toInt() // 0 .. 255
|
||||
val NeXTSTEP = minOf(intStep + 1, 255) // 1 .. 255
|
||||
val NeXTSTEP = min(intStep + 1, 255) // 1 .. 255
|
||||
|
||||
out[i] = interpolateLinear(step - intStep, rgbLinLUT[intStep], rgbLinLUT[NeXTSTEP])
|
||||
}
|
||||
@@ -123,7 +123,7 @@ fun RGB.linearise(): RGB {
|
||||
}
|
||||
val step = value.clampOne() * 255f // 0.0 .. 255.0
|
||||
val intStep = step.toInt() // 0 .. 255
|
||||
val NeXTSTEP = minOf(intStep + 1, 255) // 1 .. 255
|
||||
val NeXTSTEP = min(intStep + 1, 255) // 1 .. 255
|
||||
|
||||
out[i] = interpolateLinear(step - intStep, rgbUnLinLUT[intStep], rgbUnLinLUT[NeXTSTEP])
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package net.torvald.colourutil
|
||||
|
||||
import com.jme3.math.FastMath
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
/**
|
||||
* OBSOLETE; use CIELchUtil for natural-looking colour
|
||||
@@ -75,8 +77,8 @@ object HSVUtil {
|
||||
val g = color.g
|
||||
val b = color.b
|
||||
|
||||
val rgbMin = FastMath.min(r, g, b)
|
||||
val rgbMax = FastMath.max(r, g, b)
|
||||
val rgbMin = min(min(r, g), b)
|
||||
val rgbMax = max(max(r, g), b)
|
||||
|
||||
var h: Float
|
||||
val s: Float
|
||||
|
||||
@@ -110,7 +110,7 @@ public class HUSLColorConverter {
|
||||
float x = intersectLineLine(line, new float[]{-1 / m1, 0});
|
||||
float length = distanceFromPole(new float[]{x, b1 + x * m1});
|
||||
|
||||
min = FastMath.min(min, length);
|
||||
min = Math.min(min, length);
|
||||
}
|
||||
|
||||
return min;
|
||||
@@ -125,7 +125,7 @@ public class HUSLColorConverter {
|
||||
for (float[] bound : bounds) {
|
||||
Length length = lengthOfRayUntilIntersect(hrad, bound);
|
||||
if (length.greaterEqualZero) {
|
||||
min = FastMath.min(min, length.length);
|
||||
min = Math.min(min, length.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user