Created
January 29, 2016 17:10
-
-
Save nasser/29a3754a6b47873bbc5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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