Path

public struct Path
extension Path: CollectionWrapping
extension Path: Additive
extension Path: Equatable
extension Path: CustomStringConvertible

Undocumented

Instance Properties

  • Undocumented

    Declaration

    Swift

    public var isShape: Bool { get }
  • Declaration

    Swift

    public var isEmpty: Bool { get }

    Return Value

    true if there are no non-.close elements contained herein. Otherwise, false.

  • Warning

    This uses a simplification technique for calculateing the bounding boxes of quadratic and cubic Bézier curves, which may result in some inaccuracy for whacky curves.

    Declaration

    Swift

    public var axisAlignedBoundingBox: Rectangle { get }

    Return Value

    The axis-aligned bounding box for Path.

  • Undocumented

    Declaration

    Swift

    public let curves: [BezierCurve]

Initializers

Instance Methods

  • Declaration

    Swift

    public func simplified(segmentCount: Int) -> Polygon

    Return Value

    Polygonal representation of the Path.

Arrowhead

Circle

  • Declaration

    Swift

    public static func circle(center: Point, radius: Double) -> Path

    Return Value

    Path with a circle shape with the given radius and center.

Ellipse

  • Declaration

    Swift

    public static func ellipse(in rect: Rectangle) -> Path

    Return Value

    Path with an ellipse shape within the given rectangle.

  • Undocumented

    Declaration

    Swift

    public static func line(from start: Point, to end: Point) -> Path

Parallelogram

  • Note

    The sides are always vertical, independant of the slope.

    Note

    Useful for accidental components and system dividers.

    Declaration

    Swift

    public static func parallelogram(
        center: Point,
        height: Double,
        width: Double,
        slope: Double
    ) -> Path

    Return Value

    Path of a slanted bar.

  • Creates a Path with the given polygon.

    Declaration

    Swift

    public init<P>(_ polygon: P) where P : PolygonProtocol
  • Undocumented

    Declaration

    Swift

    public init(vertices: [Point])

Rectangle

  • Declaration

    Swift

    public static func rectangle(_ rect: Rectangle) -> Path

    Return Value

    Path with a rectangle shape defined by rectangle.

  • Declaration

    Swift

    public static func rectangle(origin: Point, size: Size) -> Path

    Return Value

    Path with a rectangle shape with the given origin and size.

  • Declaration

    Swift

    public static func rectangle(x: Double, y: Double, width: Double, height: Double) -> Path

    Return Value

    Path with a rectangle shape with the given x, y, width, and height values.

Square

  • Undocumented

    Declaration

    Swift

    public static func square(center: Point, width: Double) -> Path

Transforms

  • Declaration

    Swift

    public func scaled(by amount: Double, from reference: Point = Point()) -> Path

    Return Value

    Path scaled by the given amount from the given reference point.

  • Declaration

    Swift

    public func rotated(by angle: Angle, around reference: Point = Point()) -> Path

    Return Value

    Path rotated by the given angle around the given reference point.

  • Declaration

    Swift

    public func translated(by point: Point) -> Path

    Return Value

    Path translated by the given point.

  • Declaration

    Swift

    public func translatedBy(x: Double, y: Double) -> Path

    Return Value

    Path translated by the given x and y values.

Type Properties

  • Declaration

    Swift

    public static var builder: AllowingMoveTo { get }

    Return Value

    Builder object that only exposes the move(to:) method, as it is a required first element for a Path.

  • Declaration

    Swift

    public var base: [BezierCurve] { get }
  • Empty path.

    Declaration

    Swift

    public static let zero: Path
  • Declaration

    Swift

    public static func + (lhs: Path, rhs: Path) -> Path

    Return Value

    New Path with elements of two paths.

CustomStringConvertible

  • Printed description.

    Declaration

    Swift

    public var description: String { get }