LinearBezier

public struct LinearBezier<Output> : DeCasteljauSolvableBezierType, CustomStringConvertible where Output : BezierPointType

A linear Bézier curve of degree 1, or simply a line.

It is convenient mostly as the result of the derivative of a degree 2, or quadratic- Bézier curve.

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

    Declaration

    Swift

    public let p1: Output
  • The number of points in this linear Bézier curve; always 2.

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

    Declaration

    Swift

    @inlinable
    public init(p0: Output, p1: 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 linear 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) -> LinearBezier<Output>

Available where Input == Double

  • Returns the length of this linear Bézier.

    Declaration

    Swift

    public func length() -> Input