BezierCurve

public struct BezierCurve
extension BezierCurve: Equatable
extension BezierCurve: CustomStringConvertible

Model of a Bézier curve.

Instance Properties

  • Todo

    Consider making func with accuracy parameter.

    Declaration

    Swift

    public var axisAlignedBoundingBox: Rectangle { get }
  • Order of BezierCurve.

    Declaration

    Swift

    public var order: Order { get }
  • Start point.

    Declaration

    Swift

    public var start: Point { get }
  • end

    End point.

    Declaration

    Swift

    public var end: Point { get }
  • Arc length of BezierCurve.

    Todo

    Add customizability to accuracy.

    Declaration

    Swift

    public var length: Double { get }
  • The control points defining a Bézier curve.

    Declaration

    Swift

    public let points: [Point]

Initializers

  • Creates a linear BezierCurve with the given start and end points.

    Declaration

    Swift

    public init(start: Point, end: Point)
  • Creates a linear BezierCurve with the given line.

    Declaration

    Swift

    public init(_ line: Line.Segment)
  • Creates a quadratic BezierCurve with the given start, control and end points.

    Declaration

    Swift

    public init(start: Point, control: Point, end: Point)
  • Creates a cubic BezierCurve with the given start, control and end points.

    Declaration

    Swift

    public init(start: Point, control1: Point, control2: Point, end: Point)

Subscripts

  • Declaration

    Swift

    public subscript(t: Double) -> Point { get }

    Return Value

    Point at the given t value.

Instance Methods

  • Declaration

    Swift

    public func ts(x: Double) -> Set<Double>

    Return Value

    t values for the given x.

  • Declaration

    Swift

    public func ts(y: Double) -> Set<Double>

    Return Value

    t values for the given y.

  • Declaration

    Swift

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

    Return Value

    Vertical positions for the given x.

  • Declaration

    Swift

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

    Return Value

    Horizontal positions for the given y.

  • Declaration

    Swift

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

    Return Value

    BezierCurve translated by the given point.

  • Declaration

    Swift

    public func translatedBy(x: Double = 0, y: Double = 0) -> BezierCurve

    Return Value

    BezierCurve translated by the given x and y values.

  • Declaration

    Swift

    public func split(t: Double) -> (BezierCurve, BezierCurve)

    Return Value

    Two BezierCurve values of the same order as self, split at the given t value.

  • Declaration

    Swift

    public func simplified(segmentCount: Int) -> [Point]

    Return Value

    Array of Point values.

  • Declaration

    Swift

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

    Return Value

    BezierCurve which is scaled by the given amount from the given reference point.

  • Declaration

    Swift

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

    Return Value

    BezierCurve which is rotated by the given angle around the given reference point.

Nested Types