Skip to content

Instantly share code, notes, and snippets.

@nasser
Created January 29, 2016 17:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nasser/29a3754a6b47873bbc5a to your computer and use it in GitHub Desktop.
Save nasser/29a3754a6b47873bbc5a to your computer and use it in GitHub Desktop.
(defrecord Face [vertices normal]
IHashEq
(hasheq [this] (bit-xor (.hasheq (.vertices this))
(.GetHashCode (.normal this))))
Object
(ToString [this] (str "#Face[" (.normal this) " " (.vertices this) "]"))
IPersistentCollection
(count [this] (count (.vertices this)))
(clojure.lang.IPersistentCollection.cons
[this o]
(Face. (conj (.vertices this) o)
(.normal this)))
(empty [this] (Face. [] Vector3/zero))
(equiv [this o]
(and ; (isa? (type o) Face)
(some? o)
(some? this)
(= (.vertices this) (.vertices o))
(= (.normal this) (.normal o))))
Counted
(count [this] (count (.vertices this)))
Indexed
(nth [this i] (get (.vertices this) i))
(nth [this i else] (get (.vertices this) i else))
Seqable
(seq [^Face this] (seq (.vertices this))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment