replacing min/max usage with kotlin's

This commit is contained in:
minjaesong
2023-07-11 01:54:46 +09:00
parent d96b7d1b84
commit 79f19120f2
66 changed files with 308 additions and 345 deletions

View File

@@ -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])
}

View File

@@ -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

View File

@@ -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);
}
}