 
 (def front-coordinate (nth coordinates front-segment))
 
+(def vehicle-bearing (bearing back-coordinate front-coordinate))
+
 (def distance-to-front-segment (- back-distance meters-away))
+
+;(pprint coordinates)
+
+(interpolate-coordinates front-coordinate distance-to-front-segment vehicle-bearing)
 
 (defroutes routes
   (POST "/rush-hour/api/triangulate/edn" {:keys [body]}

        a (+ (* (Math/sin (/ dlat 2)) (Math/sin (/ dlat 2)))
             (* (Math/sin (/ dlon 2)) (Math/sin (/ dlon 2))
                (Math/cos lat1) (Math/cos lat2)))]
    (* 1000 (* R 2 (Math/asin (Math/sqrt a))))))

(def coordinates (reverse (decode-polyline (polyline))))


(def pairs (partition 2 1 coordinates))

(def segments (map (fn [[a b]] (haversine a b)) pairs))

(def back-segment (take-segments segments meters-away))

