   (+ (* (:x a) (:x b))
      (* (:y a) (:y b))))
 
+; computes the tangent of the center point b
+; returns both the "leftward-pointing" and "rightward-pointing" tangents
+(defn v2-center-tangents [a b c]
+  (let [left-tan (v2-tangent b a)
+        right-tan (v2-tangent c b)
+        avg-tan (v2-add left-tan right-tan)]
+    (if (zero-vector? avg-tan)
+      ; if left and right tangents are exactly opposite
+      ; normalization of the average would cause divide-by-zero
+      ; in this case, just give the normalized left and right tangents
+      [(v2-reverse left-tan) right-tan]
+      (let [normed-tan (v2-normalize avg-tan)]
+        [(v2-reverse normed-tan) normed-tan]))))
 
 (defn parameter-normalize [params]
   (let [last-t (last params)]

(defn v2-tangent [a b]
  (v2-normalize (v2-sub a b)))

; computes the tangent of the center point b
; the direction is in the "rightwards" direction
(defn v2-center-tangent [a b c]
  (let [left-tan (v2-sub b a)
        right-tan (v2-sub c b)
        avg-tan (v2-add left-tan right-tan)]
    (v2-normalize avg-tan)))

(defn v2-dist [a b]
  (v2-mag (v2-sub a b)))


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

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