SFShamosHoey

Objective-C

@interface SFShamosHoey : NSObject

Swift

class SFShamosHoey : NSObject

Shamos-Hoey simple polygon detection

Based upon C++ implementation: http://geomalgorithms.com/a09-_intersect-3.html

C++ implementation license:

Copyright 2001 softSurfer, 2012 Dan Sunday This code may be freely used and modified for any purpose providing that this copyright notice is included with it. SoftSurfer makes no warranty for this code, and cannot be held liable for any real or imagined damage resulting from its use. Users of this code must verify correctness for their application.

  • Determine if the polygon is simple

    Declaration

    Objective-C

    + (BOOL)simplePolygon:(SFPolygon *)polygon;

    Swift

    class func simplePolygon(_ polygon: SFPolygon!) -> Bool

    Parameters

    polygon

    polygon

    Return Value

    true if simple, false if intersects

  • Determine if the polygon points are simple

    Declaration

    Objective-C

    + (BOOL)simplePolygonPoints:(NSArray<SFPoint *> *)points;

    Swift

    class func simplePolygonPoints(_ points: [SFPoint]!) -> Bool

    Parameters

    points

    polygon as points

    Return Value

    true if simple, false if intersects

  • Determine if the polygon point rings are simple

    Declaration

    Objective-C

    + (BOOL)simplePolygonRingPoints:(NSArray<NSArray<SFPoint *> *> *)pointRings;

    Swift

    class func simplePolygonRingPoints(_ pointRings: [[SFPoint]]!) -> Bool

    Parameters

    pointRings

    polygon point rings

    Return Value

    true if simple, false if intersects

  • Determine if the polygon line string ring is simple

    Declaration

    Objective-C

    + (BOOL)simplePolygonRing:(SFLineString *)ring;

    Swift

    class func simplePolygonRing(_ ring: SFLineString!) -> Bool

    Parameters

    ring

    polygon ring as a line string

    Return Value

    true if simple, false if intersects

  • Determine if the polygon rings are simple

    Declaration

    Objective-C

    + (BOOL)simplePolygonRings:(NSArray<SFLineString *> *)rings;

    Swift

    class func simplePolygonRings(_ rings: [SFLineString]!) -> Bool

    Parameters

    rings

    polygon rings

    Return Value

    true if simple, false if intersects