All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy