refactor float3x3+3D

This commit is contained in:
Paul Zabelin
2016-02-21 04:59:18 -08:00
parent 5ab6f936d4
commit 74335d41b2
4 changed files with 7 additions and 7 deletions

View File

@@ -32,6 +32,6 @@ public extension Quadrilateral {
public func projectiveTransform(quad:Quadrilateral) -> CATransform3D {
let projection = general2DProjection(quad)
print(projection)
return CATransform3D(projection)
return CATransform3D(projection.to3d())
}
}

View File

@@ -9,7 +9,7 @@
import QuartzCore
import simd
extension CATransform3D {
extension float3x3 {
static let addColumn : float4x3 = {
var m = float4x3(diagonal:float3(1,1,0))
m[3,2] = 1
@@ -22,9 +22,9 @@ extension CATransform3D {
return m
}()
init(_ m: float3x3) {
var result = CATransform3D.addRow * m * CATransform3D.addColumn
func to3d() -> float4x4 {
var result = float3x3.addRow * self * float3x3.addColumn
result[2,2] = 1
self.init(result)
return result
}
}