mirror of
https://github.com/zhigang1992/PerspectiveTransform.git
synced 2026-04-30 05:05:17 +08:00
use convenience initializers
This commit is contained in:
@@ -8,11 +8,11 @@
|
||||
|
||||
public extension Perspective {
|
||||
|
||||
public convenience init(points:[CGPoint]) {
|
||||
public convenience init(_ points:[CGPoint]) {
|
||||
self.init(Quadrilateral(points))
|
||||
}
|
||||
|
||||
public convenience init(rect:CGRect) {
|
||||
public convenience init(_ rect:CGRect) {
|
||||
self.init(Quadrilateral(rect))
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ public final class Quadrilateral {
|
||||
public let corners : [CGPoint]
|
||||
|
||||
public init(_ points:[CGPoint]) {
|
||||
assert(points.count == 4, "exactly 4 corners required")
|
||||
corners = points
|
||||
}
|
||||
public convenience init(_ origin:CGPoint, _ size:CGSize) {
|
||||
|
||||
Reference in New Issue
Block a user