Skip to content

Instantly share code, notes, and snippets.

@rudkovskyi

rudkovskyi/w1.cljs Secret

Created Oct 2, 2018
Embed
What would you like to do?
(defn- line-segment
[a b c]
{:pre [(every? number? (flatten (if c [a b c] [a b])))
(not (some js/isNaN (flatten (if c [a b c] [a b]))))]
:post [(satisfies? g/PVertexAccess %)]}
(if c
(case (count c)
2 (->> [a c b] (map vec2) dm/qbezier->cbezier b/bezier2)
3 (->> [a c b] (map vec3) dm/qbezier->cbezier b/bezier3))
(case (count a)
2 (l/line2 a b)
3 (l/line3 a b))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.