     return de
 }
 
-private func BezierDerivative(p: [Vector2D]) -> [Vector2D] {
+private func BezierDerivative(p: [Vector]) -> [Vector] {
     let n = Double(p.count)
-    var de = [Vector2D]()
-    var lastPoint = p.first!
-    for current in p.dropFirst() {
-        de.append(n * (current - lastPoint))
-        lastPoint = current
-    }
-    return de
-}
-
-private func BezierDerivative(p: [Vector3D]) -> [Vector3D] {
-    let n = Double(p.count)
-    var de = [Vector3D]()
+    var de = [Vector]()
     var lastPoint = p.first!
     for current in p.dropFirst() {
         de.append(n * (current - lastPoint))

}

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

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


    return ([p.first!] + split.0, split.1 + [p.last!])
}

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 = [Vector]()
    var lastPoint = p.first!
    for current in p.dropFirst() {
        subpath.append(_t * lastPoint + t * current)
