Intersectable

public protocol Intersectable : AnyObject, Shape

Any shape that can calculate points of intersection between itself and a Line or Vector

  • Find any intersection points between the receiver and the specified line

    Declaration

    Swift

    func intersections(with otherShape: Intersectable) -> [Vector]

    Parameters

    line

    Line to intersect

  • lineSegments(_:firstOnly:) Default implementation

    Returns Line segments made of paired points where the specified line intersects

    Default Implementation

    Declaration

    Swift

    @available(*, deprecated)
    func lineSegments(_ line: Line, firstOnly: Bool) -> [Line]

    Parameters

    line

    The line to test for intersection

    firstOnly

    Return only a Line to the closest intersection point

Convenience Methods

  • Find any intersection points between the receiver and the specified line

    Declaration

    Swift

    @available(*, deprecated)
    public func lineIntersection(startPoint: Vector, endPoint: Vector) -> [Vector]

    Parameters

    startPoint

    Starting point of the Line

    endPoint

    Ending point of the Line

    Return Value

    An array of intersection points

  • Returns Line segments made of paired points where the specified line intersects

    Declaration

    Swift

    @available(*, deprecated)
    public func lineSegments(startPoint: Vector, endPoint: Vector, firstOnly: Bool) -> [Line]

    Parameters

    startPoint

    Starting point of the Line

    endPoint

    Ending point of the Line

Available where Self: Polygon