MBQuadrangle


@interface MBQuadrangle : NSObject

Class represents the quadrangle (arbitrary geometric object with 4 different corner points

  • Upper left point

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGPoint upperLeft;

    Swift

    var upperLeft: Point { get set }
  • Upper right point

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGPoint upperRight;

    Swift

    var upperRight: Point { get set }
  • Lower left point

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGPoint lowerLeft;

    Swift

    var lowerLeft: Point { get set }
  • Lower right point

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGPoint lowerRight;

    Swift

    var lowerRight: Point { get set }
  • Designated initializer which initializes all four corners of the quadrangle

    Declaration

    Objective-C

    - (nonnull instancetype)initWithUpperLeft:(CGPoint)upperLeft
                                   upperRight:(CGPoint)upperRight
                                    lowerLeft:(CGPoint)lowerLeft
                                   lowerRight:(CGPoint)lowerRight;

    Swift

    init(upperLeft: Any!, upperRight: Any!, lowerLeft: Any!, lowerRight: Any!)

    Parameters

    upperLeft

    upper left corner of the quadrangle

    upperRight

    upper right corner of the quadrangle

    lowerLeft

    lower left corner of the quadrangle

    lowerRight

    lower right corner of the quadrangle

    Return Value

    initialized quadrangle with four corners

  • Returns points of the quadrangle in array in the following order:

    • upperLeft, upperRight, lowerLeft, lowerRight.

    The array contains object obtained by, e.g: [NSValue valueWithCGPoint:CGPointMake(0.0, 1.0)]

    Declaration

    Objective-C

    - (nonnull NSArray *)toPointsArray;

    Swift

    func toPointsArray() -> [Any]

    Return Value

    points of the quadrangle in an array

  • Creates new quadrangle from this quadrangle, transformed by specified affine transformation.

    Declaration

    Objective-C

    - (nonnull instancetype)quadrangleWithTransformation:
        (CGAffineTransform)transform;

    Swift

    func withTransformation(_ transform: Any!) -> Self
  • Returns the center point of the Quadrangle

    Declaration

    Objective-C

    - (CGPoint)center;

    Swift

    func center() -> Any!

    Return Value

    center point