RotatedRect

Objective-C

@interface RotatedRect : NSObject

Swift

class RotatedRect : NSObject

Represents a rotated rectangle on a plane

Properties

  • Declaration

    Objective-C

    @property Point2f* center

    Swift

    var center: Point2f { get set }
  • Declaration

    Objective-C

    @property Size2f* size

    Swift

    var size: Size2f { get set }
  • Declaration

    Objective-C

    @property double angle

    Swift

    var angle: Double { get set }

Constructors

  • Declaration

    Objective-C

    - (instancetype)init;

    Swift

    init()
  • Declaration

    Objective-C

    - (instancetype)initWithCenter:(Point2f*)center size:(Size2f*)size angle:(double)angle;

    Swift

    init(center: Point2f, size: Size2f, angle: Double)
  • Declaration

    Objective-C

    - (instancetype)initWithVals:(NSArray<NSNumber*>*)vals;

    Swift

    init(vals: [NSNumber])

Methods

  • Returns the corner points of the rotated rectangle as an array

    Declaration

    Objective-C

    - (nonnull NSArray<Point2f *> *)points;

    Swift

    func points() -> [Point2f]
  • Returns the bounding (non-rotated) rectangle of the rotated rectangle

    Declaration

    Objective-C

    - (nonnull Rect2f *)boundingRect;

    Swift

    func boundingRect() -> Rect2f
  • Set the rotated rectangle coordinates, dimensions and angle of rotation from the values of an array

    Declaration

    Objective-C

    - (void)set:(nonnull NSArray<NSNumber *> *)vals;

    Swift

    func set(vals: [NSNumber])

    Parameters

    vals

    The array of values from which to set the rotated rectangle coordinates, dimensions and angle of rotation

Common Methods

  • Clone object

    Declaration

    Objective-C

    - (nonnull RotatedRect *)clone;

    Swift

    func clone() -> RotatedRect
  • Compare for equality

    Declaration

    Objective-C

    - (BOOL)isEqual:(nullable id)object;

    Swift

    func isEqual(_ object: Any?) -> Bool

    Parameters

    other

    Object to compare

  • Calculate hash value for this object

    Declaration

    Objective-C

    - (NSUInteger)hash;

    Swift

    func hash() -> UInt
  • Returns a string that describes the contents of the object

    Declaration

    Objective-C

    - (nonnull NSString *)description;

    Swift

    func description() -> String