Polygon

public protocol Polygon : Intersectable

Represens a Shape that has an internal area

  • The center of the shape

    Declaration

    Swift

    var center: Vector { get set }
  • A boolean indicating whether the specified point lies within the shape

    Declaration

    Swift

    func contains(_ point: Vector) -> Bool
  • Return the intersection point of the specified angle from the center of the shape

    Declaration

    Swift

    func point(at angle: Radians) -> Vector

    Parameters

    angle

    The angle

  • The angle of a point relative to the center

    Declaration

    Swift

    func angle(ofPoint point: Vector) -> Radians

    Parameters

    point

    The point to to determine the angle between.

  • Create a Bézier path representing the shaoe

    Declaration

    Swift

    func bezierCurve(start: Radians, end: Radians) -> [BezierPath]

    Parameters

    start

    Starting angle

    end

    Ending Angle

    Return Value

    An array of BezierPath which draw the shape

  • booleanOperation(_:_:) Extension method

    Perform a Boolean operation between the specified shapes.

    Declaration

    Swift

    public func booleanOperation(_ shapes: [Polygon], _ operation: BooleanOperation = .add) -> [BezierPath]

    Parameters

    shapes

    Shapes to operate on

    operation

    The operation to perform

    Return Value

    An array of the resulting paths