We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f015d38 commit e35455bCopy full SHA for e35455b
slider/src/main/java/io/monstarlab/mosaic/slider/LinearEquation.kt
@@ -0,0 +1,10 @@
1
+package io.monstarlab.mosaic.slider
2
+
3
+public data class LinearEquation(
4
+ private val m: Float,
5
+ private val c: Float,
6
+) {
7
+ public fun valueFromOffset(offset: Float): Float = m * offset + c
8
9
+ public fun offsetFromValue(value: Float): Float = (value - c) / m
10
+}
slider/src/main/java/io/monstarlab/mosaic/slider/RangedLinearEquation.kt
@@ -0,0 +1,7 @@
+public data class RangedLinearEquation(
+ val equation: LinearEquation,
+ val offsetRange: ClosedFloatingPointRange<Float>,
+ val valueRange: ClosedFloatingPointRange<Float>,
+)
0 commit comments