     let magnitude = z.magnitude
     return a.map { Point(x: $0.x * magnitude, y: -$0.y) * SDTransform.Rotate(angle) + p0 }
 }
-public func BezierVariableOffset(p0: Point, p1: Point, p2: Point, a0: Point, a1: Point) -> [[Point]] {
-    
-    return BezierVariableOffset(p0: p0, p1: p1, p2: p2, a0: a0, a1: a1, 8)
-}
-private func BezierVariableOffset(p0: Point, p1: Point, p2: Point, a0: Point, a1: Point, _ limit: Int) -> [[Point]] {
+private func BezierVariableOffset(p0: Point, p1: Point, p2: Point, _ a: [Point], _ limit: Int) -> [[Point]] {
     
     let q0 = p1 - p0
     let q1 = p2 - p1

    
    func split_half() -> [[Point]] {
        let (p_left, p_right) = SplitBezier(0.5, p0, p1, p2)
        let (a_left, a_right) = SplitBezier(half_length / length, a0, a1)
        return BezierVariableOffset(p0: p_left[0], p1: p_left[1], p2: p_left[2], a0: Point(x: 0, y: a_left[0].y), a1: Point(x: 1, y: a_left[1].y), limit - 1) + BezierVariableOffset(p0: p_right[0], p1: p_right[1], p2: p_right[2], a0: Point(x: 0, y: a_right[0].y), a1: Point(x: 1, y: a_right[1].y), limit - 1)
    }
    
    if limit > 0 && BezierOffsetCurvature(p0, p1, p2) {

    
    let s = 1 / q0.magnitude
    let t = 1 / q1.magnitude
    let a_first = a.first!
    let a_last = a.last!
    let start = Point(x: p0.x + a_first.y * q0.y * s, y: p0.y - a_first.y * q0.x * s)
    let end = Point(x: p2.x + a_last.y * q1.y * t, y: p2.y - a_last.y * q1.x * t)
    
    let z0 = a.lazy.map { $0 - a_first }.first { !$0.x.almostZero() || !$0.y.almostZero() }!
    let z1 = a.reversed().lazy.map { a_last - $0 }.first { !$0.x.almostZero() || !$0.y.almostZero() }!
    
    if let mid = QuadBezierFitting(start, end, q0 * SDTransform.Rotate(z0.phase), q1 * SDTransform.Rotate(z1.phase)) {
        return limit > 0 && BezierOffsetCurvature(start, mid, end) ? split_half() : [[start, mid, end]]
    }
    
    return BezierVariableOffset(p0, p2, a).map { [$0] } ?? []
}

// MARK: Stationary Points
