     private static func xIntercept(curve: BezierCurve, y: CGFloat) -> CGFloat {
         let startingPoint = curve.startingPoint
         let endingPoint   = curve.endingPoint
-        
-        guard y != curve.startingPoint.y else {
-            return curve.startingPoint.x
-        }
-        guard y != curve.endingPoint.y else {
-            return curve.endingPoint.x
-        }
-
-        if curve.order == 1 {
-            let t = ( y - startingPoint.y ) / ( endingPoint.y - startingPoint.y )
-            let x = startingPoint.x * (1.0 - t) + endingPoint.x * t
-            return x
-        }
-        else {
+        guard y != curve.startingPoint.y else { return curve.startingPoint.x }
+        guard y != curve.endingPoint.y else { return curve.endingPoint.x }
+        let linearSolutionT = ( y - startingPoint.y ) / ( endingPoint.y - startingPoint.y )
+        let linearSolution = LineSegment(p0: startingPoint, p1: endingPoint).compute(linearSolutionT).x
+        if curve.order > 1 {
             let line = LineSegment(p0: CGPoint(x: 0, y: y), p1: CGPoint(x: 1, y: y))
-            if let t = Utils.roots(points: curve.points, line: line).first(where: { $0 >= 0.0 && $0 <= 1.0 }) {
-                return curve.compute(CGFloat(t)).x
-            } else {
-                // warning: we haven't hit this code path but it's probably possible due to roundoff: UNIT TESTS
-                return curve.boundingBox.max.x
-            }
+            guard let t = Utils.roots(points: curve.points, line: line).first(where: { $0 >= 0.0 && $0 <= 1.0 }) else {
+                assertionFailure("roots failed. Good test data?")
+                return linearSolution
+            }
+            return curve.compute(CGFloat(t)).x
+        } else {
+            return linearSolution
         }
     }
 

                return true // recurse
            }
            
            let element = self.element(at: elementIndex)
            var extrema = element.extrema().xyz[1]
            if extrema.contains(0) == false {

                let t1 = extrema[i]
                let t2 = extrema[i+1]
                let subcurve = element.split(from: t1, to: t2)
                if subcurve.boundingBox.min.x > point.x { continue }
                // we include the highest point and exclude the lowest point
                // that ensures if the juncture between curves changes direction it's counted twice or not at all
                // and if the juncture between curves does not change direction it's counted exactly once
                let increment = adjustment(point.y, subcurve.startingPoint.y, subcurve.endingPoint.y)
                guard increment != 0 else { continue }
                if subcurve.boundingBox.max.x >= point.x {
                    // slowest path: must determine x intercept and test against it
                    let x = PathComponent.xIntercept(curve: subcurve, y: point.y)
                    guard point.x > x else { continue }
                }
