Point2f

Objective-C

@interface Point2f : NSObject

Swift

class Point2f : NSObject

Represents a two dimensional point the coordinate values of which are of type float

  • x

    Declaration

    Objective-C

    @property float x

    Swift

    var x: Float { get set }
  • y

    Declaration

    Objective-C

    @property float y

    Swift

    var y: Float { get set }
  • Declaration

    Objective-C

    - (instancetype)init;

    Swift

    init()
  • Declaration

    Objective-C

    - (instancetype)initWithX:(float)x y:(float)y;

    Swift

    init(x: Float, y: Float)
  • Declaration

    Objective-C

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

    Swift

    init(vals: [NSNumber])
  • Calculate the dot product of this point and another point

    Declaration

    Objective-C

    - (double)dot:(nonnull Point2f *)point;

    Swift

    func dot(_ point: Point2f) -> Double

    Parameters

    point

    The other point

  • Determine if the point lies with a specified rectangle

    Declaration

    Objective-C

    - (BOOL)inside:(nonnull Rect2f *)rect;

    Swift

    func inside(_ rect: Rect2f) -> Bool

    Parameters

    rect

    The rectangle

  • Set the point coordinates 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 coordinates

  • Clone object

    Declaration

    Objective-C

    - (nonnull Point2f *)clone;

    Swift

    func clone() -> Point2f
  • Compare for equality

    Declaration

    Objective-C

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

    Swift

    func isEqual(_ other: 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