     
     let s = 1 / q0.magnitude
     let t = 1 / q1.magnitude
-    let start = Point(x: p0.x + a0.y * q0.y * s, y: p0.y - a0.y * q0.x * s)
-    let end = Point(x: p2.x + a1.y * q1.y * t, y: p2.y - a1.y * q1.x * t)
-    
-    let z = Point(x: a1.x * length, y: -a1.y) - Point(x: a0.x * length, y: -a0.y)
-    let zh = z.phase
-    
-    if let mid = QuadBezierFitting(start, end, q0 * SDTransform.Rotate(zh), q1 * SDTransform.Rotate(zh)) {
+    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, a0, a1).map { [$0] } ?? []
+    return BezierVariableOffset(p0, p2, a).map { [$0] } ?? []
 }
 
 // MARK: Stationary Points

    if ph0.almostEqual(ph1 + M_PI) || ph0.almostEqual(ph1 - M_PI) {
        if let w = QuadBezierStationary(p0.x, p1.x, p2.x) ?? QuadBezierStationary(p0.y, p1.y, p2.y) {
            let mid_length = QuadBezierLength(w, p0, p1, p2)
            let (a_left, a_right) = SplitBezier(mid_length / length, a0, a1)
            let g = Bezier(w, p0, p1, p2)
            if let left = BezierVariableOffset(p0, g, Point(x: 0, y: a_left[0].y), Point(x: 1, y: a_left[1].y)), let right = BezierVariableOffset(g, p2, Point(x: 0, y: a_right[0].y), Point(x: 1, y: a_right[1].y)) {
                let angle = ph0 - M_PI_2
                let bezierCircle = BezierCircle.lazy.map { $0 * SDTransform.Rotate(angle) * a_left[1].y + g }
                let i = [bezierCircle[0],
                         bezierCircle[1],
                         bezierCircle[2],

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