Created
November 15, 2014 00:21
-
-
Save nasser/c823bf081f3401158e93 to your computer and use it in GitHub Desktop.
triangle index functions
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
(defn tri-strip | |
([size] (tri-strip 0 size)) | |
([start size] | |
(->> (range start (+ start size)) | |
(partition 4 1) | |
(map (fn [[a b c d]] [a b c | |
c b d])) | |
flatten))) | |
(defn tri-fan | |
([size] (tri-fan 0 size)) | |
([start size] | |
(->> (range (inc start) (+ start size)) | |
(partition 2 1) | |
(map #(conj % start)) | |
flatten))) | |
(defn tris | |
([size] (tris 0 size)) | |
([start size] | |
(->> (range start (+ start size)) | |
(partition 3) | |
flatten))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment