     return ([p.first!] + split.0, split.1 + [p.last!])
 }
 
-private func SplitBezier(t: Double, _ p: [Vector2D]) -> ([Vector2D], [Vector2D]) {
+private func SplitBezier(t: Double, _ p: [Vector]) -> ([Vector], [Vector]) {
     let _t = 1 - t
     if p.count == 2 {
         let split = _t * p.first! + t * p.last!
         return ([p.first!, split], [split, p.last!])
     }
-    var subpath = [Vector2D]()
-    var lastPoint = p.first!
-    for current in p.dropFirst() {
-        subpath.append(_t * lastPoint + t * current)
-        lastPoint = current
-    }
-    let split = SplitBezier(t, subpath)
-    return ([p.first!] + split.0, split.1 + [p.last!])
-}
-
-private func SplitBezier(t: Double, _ p: [Vector3D]) -> ([Vector3D], [Vector3D]) {
-    let _t = 1 - t
-    if p.count == 2 {
-        let split = _t * p.first! + t * p.last!
-        return ([p.first!, split], [split, p.last!])
-    }
-    var subpath = [Vector3D]()
+    var subpath = [Vector]()
     var lastPoint = p.first!
     for current in p.dropFirst() {
         subpath.append(_t * lastPoint + t * current)

}

@warn_unused_result
public func SplitBezier(t: Double, _ p: Vector2D ... ) -> ([Vector2D], [Vector2D]) {
    return SplitBezier(t, p)
}

@warn_unused_result
public func SplitBezier(t: Double, _ p: Vector3D ... ) -> ([Vector3D], [Vector3D]) {
    return SplitBezier(t, p)
}


}

@warn_unused_result
public func BezierDerivative(t: Double, _ p: Vector ... ) -> Vector {
    return Bezier(t, BezierDerivative(p))
}

