mirror of
https://github.com/zhigang1992/PerspectiveTransform.git
synced 2026-05-13 10:06:42 +08:00
cleanup self.
This commit is contained in:
@@ -20,7 +20,7 @@ class PerformanceTest: XCTestCase {
|
||||
)
|
||||
)
|
||||
|
||||
self.measure {
|
||||
measure {
|
||||
stride(from:0, to: 100000, by: 1).forEach { _ in
|
||||
_ = start.projectiveTransform(destination: destination)
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ extension Matrix3x3Type {
|
||||
|
||||
func homogeneousInverse() -> Matrix3x3Type {
|
||||
#if arch(arm64) || arch(x86_64)
|
||||
let result = self.inverse
|
||||
let result = inverse
|
||||
#else
|
||||
let result = adjugate()
|
||||
#endif
|
||||
|
||||
@@ -17,21 +17,21 @@ public final class Perspective {
|
||||
|
||||
lazy var basisVectorsToPointsMap: Matrix3x3Type! = {
|
||||
let m = Matrix3x3Type([
|
||||
self.vectors[0],
|
||||
self.vectors[1],
|
||||
self.vectors[2]]
|
||||
vectors[0],
|
||||
vectors[1],
|
||||
vectors[2]]
|
||||
)
|
||||
let solution = m.homogeneousInverse() * self.vectors[3]
|
||||
let solution = m.homogeneousInverse() * vectors[3]
|
||||
let scale = Matrix3x3Type(diagonal: solution)
|
||||
let basisToPoints = m * scale
|
||||
return basisToPoints.zNormalized()
|
||||
}()
|
||||
|
||||
lazy var pointsToBasisVectorsMap: Matrix3x3Type! = {
|
||||
self.basisVectorsToPointsMap.homogeneousInverse()
|
||||
basisVectorsToPointsMap.homogeneousInverse()
|
||||
}()
|
||||
|
||||
internal func projection(to:Perspective) -> Matrix3x3Type {
|
||||
return (to.basisVectorsToPointsMap * pointsToBasisVectorsMap).zNormalized()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user