package ru.dbotthepony.kstarbound.client.gl

import ru.dbotthepony.kommons.math.intersectRectangles

data class ScissorRect(val x: Int, val y: Int, val width: Int, val height: Int) {
	fun withinBounds(x: Int, y: Int): Boolean {
		return (x in this.x .. this.x + width) && (y in this.y .. this.y + height)
	}

	fun cross(x: Int, y: Int, width: Int, height: Int): Boolean {
		return intersectRectangles(
			x, y,
			x + width, y + height,

			this.x, this.y,
			this.x + this.width, this.y + this.height,
		)
	}
}
