feat: Initial commit
This commit is contained in:
33
Sources/SharedModels/PlenumDimension.swift
Normal file
33
Sources/SharedModels/PlenumDimension.swift
Normal file
@@ -0,0 +1,33 @@
|
||||
import Foundation
|
||||
|
||||
public enum PlenumDimension: Equatable {
|
||||
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 {
|
||||
|
||||
case rectangular, round
|
||||
|
||||
public var description: String { rawValue.capitalized }
|
||||
}
|
||||
|
||||
public var key: Key {
|
||||
switch self {
|
||||
case .rectangular:
|
||||
return .rectangular
|
||||
case .round:
|
||||
return .round
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user