   ([coords tan1 tan2]
     (if (= (count coords) 2)
       ; use the heuristic if there are no intermediate points
-      (wu-barsky-heuristic (first coords) (last coords) tan1 tan2)
+      [(wu-barsky-heuristic (first coords) (last coords) tan1 tan2)]
       (let [iter-error (* fit-error fit-error)
             params (chord-parameterize coords)
             bezier (gen-bezier coords params tan1 tan2)

         coords params (range (count coords)))
    ; collect max and split-point
    (reduce (fn [[max-dist split-point :as res-pair] [i dist]]
              (if [>= dist max-dist] [dist i] res-pair))
            [0.0 (/ (count coords) 2)])))

(defn fit-cubic

(defn bezier3-pw-calc [beziers t]
  (let [i (int t)]
    (bezier3-calc (nth beziers i) (- t i))))

; having duplicate adjacent points screws up the distance
; calculations, so we need to remove them before doing the fitting
(defn dedup-points [coords]
  (reduce (fn [result c]
            (if (= 0 (v2-dist (last result) c))
              result
              (conj result c)))
          [] coords))

(defn interpolate-points [coords desired-seg-len]
  (let [path-len (path-length coords)]
