001 (ns walkmap.polygon
002 "Essentially the specification for things we shall consider to be polygons."
003 (:require [walkmap.vertex :refer [vertex?]]))
004
005 (defn polygon?
006 "True if `o` satisfies the conditions for a polygon. A polygon shall be a
007 map which has a value for the key `:vertices`, where that value is a sequence
008 of vertices."
009 [o]
010 (let
011 [v (:vertices o)]
012 (and
013 (coll? v)
014 (> (count v) 2)
015 (every? vertex? v)
016 (or (nil? (:kind o)) (= (:kind o) :polygon)))))
017
018