PolygonProtocol

public protocol PolygonProtocol : Shape

Interface for polygonal shapes.

Instance Properties

Initializers

  • Create a PolygonProtocol-conforming type with the given sequence of vertices.

    Declaration

    Swift

    init<S>(vertices: S) where S : Sequence, S.Element == Point

Instance Methods

  • contains(_:) Default implementation

    Default Implementation

    Declaration

    Swift

    func contains(_ point: Point) -> Bool

    Return Value

    true if a PolygonProtocol contains the given point.

  • edges Extension method

    Declaration

    Swift

    public var edges: [Line.Segment] { get }

    Return Value

    Array of the line values comprising the edges of the PolygonProtocol- conforming type.

  • rotation Extension method

    Declaration

    Swift

    public var rotation: Rotation { get }

    Return Value

    Whether vertices are arranged clockwise / counterclockwise.

  • triples Extension method

    Declaration

    Swift

    public var triples: [Point.Triple] { get }

    Return Value

    Each adjacent triple

  • angles Extension method

    Declaration

    Swift

    public var angles: [Angle] { get }

    Return Value

    Array of the angles.

  • contains(anyOf:) Extension method

    Declaration

    Swift

    public func contains(anyOf points: [Point]) -> Bool

    Return Value

    true if a PolygonProtocol contains any of the the given points.

  • ys(at:) Extension method

    Declaration

    Swift

    public func ys(at x: Double) -> Set<Double>

    Return Value

    A Set of all of the y-values at the given x.

  • xs(at:) Extension method

    Declaration

    Swift

    public func xs(at y: Double) -> Set<Double>

    Return Value

    A Set of all of the x-values at the given y.