CubicBezier

public struct CubicBezier<Output> : DeCasteljauSolvableBezierType, CustomStringConvertible where Output : BezierPointType
extension CubicBezier: DerivableBezierType
extension CubicBezier: Equatable where Output: Equatable
extension CubicBezier: Hashable where Output: Hashable

A cubic Bézier type.

  • Declaration

    Swift

    public typealias Input = Output.Scalar
  • p0

    The first point of this Bézier, or its starting point.

    Declaration

    Swift

    public let p0: Output
  • p1

    The second point of this Bézier, or its first control point.

    Declaration

    Swift

    public let p1: Output
  • p2

    The third point of this Bézier, or its second control point.

    Declaration

    Swift

    public let p2: Output
  • p3

    The fourth point of this Bézier, or its end point.

    Declaration

    Swift

    public let p3: Output
  • The number of points in this cubic Bézier curve; always 4.

    Declaration

    Swift

    public var pointCount: Int { get }
  • Returns the point at a specified point index.

    Precondition

    pointIndex >= 0 && pointIndex < pointCount.

    Declaration

    Swift

    @inlinable
    public subscript(pointIndex: Int) -> Output { get }
  • Declaration

    Swift

    public var points: [Output] { get }
  • Declaration

    Swift

    public var description: String { get }
  • Initializes a cubic Bézier curve with a set of four control points.

    Declaration

    Swift

    @inlinable
    public init(p0: Output, p1: Output, p2: Output, p3: Output)
  • Requests that a new output value be computed at a specified input.

    Declaration

    Swift

    @inlinable
    public func solveDeCasteljau(at input: Double) -> Output
  • Splits this cubic Bézier curve into two curves that overlap this curve, splitting it along a specified input point.

    Declaration

    Swift

    @inlinable
    public func split(at input: Double) -> (left: `Self`, right: `Self`)
  • Requests that a new output value be computed at a specified input using the fastest implementation mode available for this type.

    Declaration

    Swift

    @inlinable
    public func compute(at input: Input) -> Output
  • Returns the result of translating the points of this Bézier curve by offset.

    Declaration

    Swift

    public func translated(by offset: Output) -> CubicBezier<Output>
  • Declaration

    Swift

    public typealias DerivativeBezier = QuadBezier<Output>
  • Returns a quadratic Bézier curve that is the derivative for this cubic Bézier curve.

    Declaration

    Swift

    public func derivate() -> DerivativeBezier

Available where Output: Equatable

  • Declaration

    Swift

    public static func == (lhs: `Self`, rhs: `Self`) -> Bool

Available where Output: Hashable

  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)

Available where Input == Double

  • Returns the approximate length of this cubic Bézier.

    Declaration

    Swift

    public func length() -> Input