37. extension AngleProtocol: Hashable, Comparable {
} Stepanov, Alexander; McJones, Paul (2009). Elements of Programming. Addison-Wesley. ISBN 978-0-321-63537-2.
38. extension AngleProtocol: Hashable, Comparable {
}
static func ==(lhs: Self, rhs: Self) -> Bool {
return lhs.radians == rhs.radians
}
Stepanov, Alexander; McJones, Paul (2009). Elements of Programming. Addison-Wesley. ISBN 978-0-321-63537-2.
39. extension AngleProtocol: Hashable, Comparable {
}
static func ==(lhs: Self, rhs: Self) -> Bool {
return lhs.radians == rhs.radians
}
var hashValue: Int {
return radians.hashValue
}
Stepanov, Alexander; McJones, Paul (2009). Elements of Programming. Addison-Wesley. ISBN 978-0-321-63537-2.
40. extension AngleProtocol: Hashable, Comparable {
}
static func ==(lhs: Self, rhs: Self) -> Bool {
return lhs.radians == rhs.radians
}
var hashValue: Int {
return radians.hashValue
}
static func <(lhs: Self, rhs: Self) -> Bool {
return lhs.radians < rhs.radians
}
Stepanov, Alexander; McJones, Paul (2009). Elements of Programming. Addison-Wesley. ISBN 978-0-321-63537-2.
122. final class TypedTransforms<Base> {
let base: Base
init(_ base: Base) {
self.base = base
}
}
protocol TypedTransformAdditions {
associatedtype Typed
var typed: Typed { get }
}
123. final class TypedTransforms<Base> {
let base: Base
init(_ base: Base) {
self.base = base
}
}
protocol TypedTransformAdditions {
associatedtype Typed
var typed: Typed { get }
}
extension TypedTransformAdditions {
var typed: TypedTransforms<Self> {
return TypedTransforms(self)
}
}
128. let shotDirectionCamera =
float4_t<CameraSpace>(float4(0, 0, -3, 1))
let shotDirectionWorld = worldFromCamera *
shotDirectionCamera
let direction =
SCNVector3(float4: shotDirectionWorld.point)
let worldFromCamera =
frame.camera.typed.worldFromCamera