BDPGeometry

Objective-C

@protocol BDPGeometry <BDPDeepCopy>

Swift

protocol BDPGeometry : BDPDeepCopy

Geometrical methods required for implementation of a concrete geometry class.

  • Sometimes referred to as ‘hit test’ or ‘Point in polygon test’, this method determines whether the given “BDPoint” “point” falls on, or inside the bounds of this geometry.

    @returns YES if the point falls on or inside the bounds, NO if the point falls outside the bounds

    Declaration

    Objective-C

    - (BOOL)intersects:(BDGeometry *)geometry;

    Swift

    func intersects(_ geometry: BDGeometry!) -> Bool
  • Currently, only Circles may receive this message; other shapes will throw an assertion error in DEBUG or return NO in RELEASE.

    @returns YES if this shape fully encloses the specified shape, NO otherwise.

    Declaration

    Objective-C

    - (BOOL)isEnclosedBy:(BDGeometry *)geometry;

    Swift

    func isEnclosed(by geometry: BDGeometry!) -> Bool
  • Calculates the minimum “BDBoundingBox” “bounding-box” that encloses this geometry.

    Notably, for “BDBoundingBox” instances, this will simply return a `self` reference.

    For “BDPoint” instances, this will return a zero-sized box positioned at the point.

    @returns the minimum BDBoundingBox “bounding-box” that encloses this geometry.

    Declaration

    Objective-C

    - (BDBoundingBox *)boundingBox;

    Swift

    func boundingBox() -> BDBoundingBox!
  • @returns The centre of a geometrical shape.

    Declaration

    Objective-C

    - (BDPoint *)centroid;

    Swift

    func centroid() -> BDPoint!
  • @returns the distance to another geometric shape.

    Declaration

    Objective-C

    - (BDLocationDistance)distanceTo:(BDGeometry *)geometry;

    Swift

    func distance(to geometry: BDGeometry!) -> BDLocationDistance
  • @returns The type of current geometry. Available values: point, circle, lineString, boundingBox, polygon.

    Declaration

    Objective-C

    - (BDGeometryType)geometryType;

    Swift

    func geometryType() -> String!