package com.onthelevel.core.sensors

import kotlin.math.tan

/** Converts a positive surface tilt into the conventional rise-over-run units. */
object RiseRun {
    fun millimetersPerMeter(angleDegrees: Double): Double =
        tan(Math.toRadians(angleDegrees)) * MILLIMETERS_PER_METER

    fun inchesPerFoot(angleDegrees: Double): Double =
        tan(Math.toRadians(angleDegrees)) * INCHES_PER_FOOT

    private const val MILLIMETERS_PER_METER = 1_000.0
    private const val INCHES_PER_FOOT = 12.0
}
