mirror of
https://github.com/GayPizzaSpecifications/voxelotl-engine.git
synced 2025-08-03 13:11:33 +00:00
split rectangle
This commit is contained in:
13
Sources/Voxelotl/Math/Extent.swift
Normal file
13
Sources/Voxelotl/Math/Extent.swift
Normal file
@ -0,0 +1,13 @@
|
||||
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) }
|
||||
}
|
Reference in New Issue
Block a user