Files

34 lines
743 B
Swift

import Foundation
public enum PlenumDimension: Equatable, Sendable {
case rectangular(width: Double, height: Double)
case round(Double)
public var areaInSquareFeet: Double {
switch self {
case .rectangular(width: let width, height: let height):
return (width * height) / 144
case let .round(dimension):
return pow((dimension / 12) / 2, 2) * Double.pi
}
}
public enum Key: String, Equatable, CaseIterable, CustomStringConvertible, Sendable {
case rectangular, round
public var description: String { rawValue.capitalized }
}
public var key: Key {
switch self {
case .rectangular:
return .rectangular
case .round:
return .round
}
}
}