                              (nth coords (inc split-point)))]
             (vec (concat
                    (fit-cubic
-                     (subvec coords 0 split-point) tan1
+                     (subvec coords 0 (inc split-point)) tan1
                      (v2-reverse center-tan))
                    (fit-cubic
                       (subvec coords split-point) center-tan tan2)))))))))

          (conj (first coords)) vec (conj (last coords)))))))

(defn smooth-stroke [stroke]
  (Stroke.
    (interpolate-points (:coords stroke) 10.0)
    (:thickness stroke)))

(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)]
