mirror of
https://github.com/GayPizzaSpecifications/voxelotl-engine.git
synced 2025-08-03 05:10:57 +00:00
14 lines
438 B
Swift
14 lines
438 B
Swift
struct Extent<T: AdditiveArithmetic>: Equatable {
|
|
var top: T, bottom: T, left: T, right: T
|
|
|
|
@inline(__always) static func == (lhs: Self, rhs: Self) -> Bool {
|
|
lhs.left == rhs.left && lhs.right == rhs.right && lhs.top == rhs.top && lhs.bottom == rhs.bottom
|
|
}
|
|
}
|
|
|
|
extension Extent where T: Comparable {
|
|
var size: Size<T> { .init(
|
|
right > left ? right - left : left - right,
|
|
bottom > top ? bottom - top : top - bottom) }
|
|
}
|