     
     /// - Returns: `Point` at the given `t` value.
     public subscript (t: Double) -> Point {
-        switch points.count {
-        case 2:
+        switch order {
+        case .linear:
             return t * (end - start) + start
-        case 3:
+        case .quadratic:
             let control = points[1]
             return start * pow(1-t, 2) + control * 2 * (1-t) * t + end * pow(t,2)
-        case 4:
+        case .cubic:
             let control1 = points[1]
             let control2 = points[2]
             return (

    // MARK: - Nested Types
    
    /// Order of `BezierCurve`.
    public enum Order {
        case linear
        case quadratic
        case cubic
    }
    
    // MARK: - Instance Properties
    
    /// Order of `BezierCurve`.
    public var order: Order {
        switch points.count {
        case 2:
            return .linear
        case 3:
            return .quadratic
        case 4:
            return .cubic
        default:
            fatalError()
        }
    }
    
    /// Start point.

    /// - TODO: Add customizability to accuracy.
    ///
    public var length: Double {
        switch order {
        case .linear:
            return Line(points: points).length
        case .quadratic, .cubic:
            let points = stride(from: 0, through: 1, by: 0.01).map { t in self[t] }
            let lines = points.adjacentPairs().map(Line.init)
            return lines.map { $0.length }.sum
        }
    }
    
