mirror of
https://github.com/zhigang1992/PerspectiveTransform.git
synced 2026-01-12 22:49:33 +08:00
23 lines
666 B
Swift
23 lines
666 B
Swift
import Quick
|
|
import Nimble
|
|
import PerspectiveTransform
|
|
|
|
struct MatrixMethod: TransformMatrixCalculator {
|
|
func transform(frame: CGRect, points: [CGPoint]) -> CATransform3D {
|
|
return Perspective(frame).projectiveTransform(destination: Perspective(points))
|
|
}
|
|
}
|
|
|
|
class CompareMethodsSpec: QuickSpec {
|
|
override func spec() {
|
|
describe("compare different methods") {
|
|
context("AlgebraMethod") {
|
|
itBehavesLike("transformer") {["method": AlgebraMethod()]}
|
|
}
|
|
context("PerspectiveTrasform") {
|
|
itBehavesLike("transformer") {["method": MatrixMethod()]}
|
|
}
|
|
}
|
|
}
|
|
}
|