QuadBezier

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

A quadratic Bézier curve of degree 2.

  • 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 end point.

    Declaration

    Swift

    public let p2: Output
  • The number of points in this quadratic Bézier curve; always 3.

    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 quadratic Bézier curve with a set of three control points.

    Declaration

    Swift

    @inlinable
    public init(p0: Output, p1: Output, p2: 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 quadratic 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) -> QuadBezier<Output>
  • Declaration

    Swift

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

    Declaration

    Swift

    public func derivate() -> DerivativeBezier

Available where Input == Double

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

    Declaration

    Swift

    public func length() -> Input