Skip to content

Instantly share code, notes, and snippets.

@skrat
Last active June 23, 2016 19:52
Show Gist options
  • Save skrat/0b79deeeca4dfdbdccc26ca8b48afc33 to your computer and use it in GitHub Desktop.
Save skrat/0b79deeeca4dfdbdccc26ca8b48afc33 to your computer and use it in GitHub Desktop.
(ns clojure-nen2580.core
(:require [thi.ng.geom.core :as g]
[thi.ng.geom.line :as l))
(defn normal [l]
(let [[p q] (:points l)]
(g/normalize (g/- q p))))
(defn continuous? [a b]
(let [na (normal a)
nb (normal b)]
(and
(some (partial g/contains-point? a) (:points b))
(= 1 (Math/abs (g/dot na nb))))))
(continuous?
(l/line2 [ 0 0] [100 0])
(l/line2 [100 0] [200 0]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment