commonMain.io.nacular.doodle.utils.Ranges.kt Maven / Gradle / Ivy
package io.nacular.doodle.utils
/**
* Created by Nicholas Eddy on 2/12/18.
*/
public infix fun > ClosedRange.intersect (other: ClosedRange): ClosedRange = maxOf(start, other.start) .. minOf(endInclusive, other.endInclusive)
public infix fun > ClosedRange.intersects(other: ClosedRange): Boolean = start in other || endInclusive in other
public val ClosedRange.size: Int get() = endInclusive - start
public val ClosedRange.size: Double get() = endInclusive - start
public val ClosedRange.size: Float get() = endInclusive - start