Mercurial > cortex
diff org/test-creature.org @ 100:940074adc1d5
can visualize a collection of points now.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 14 Jan 2012 01:19:18 -0700 |
parents | b7a3ba5e879b |
children | 65332841b7d9 |
line wrap: on
line diff
1.1 --- a/org/test-creature.org Sat Jan 14 01:07:18 2012 -0700 1.2 +++ b/org/test-creature.org Sat Jan 14 01:19:18 2012 -0700 1.3 @@ -94,8 +94,25 @@ 1.4 (.setSize frame (+ 8 (.getWidth i)) (+ 28 (.getHeight i))) 1.5 (.repaint panel 0 0 (.getWidth i) (.getHeight i))))) 1.6 1.7 +(defn points->image 1.8 + "Take a sparse collection of points and visuliaze it as a 1.9 + BufferedImage." 1.10 + [points] 1.11 + (let [xs (map first points) 1.12 + ys (map second points) 1.13 + width (- (apply max xs) (apply min xs)) 1.14 + height (- (apply max ys) (apply min ys)) 1.15 + image (BufferedImage. width height 1.16 + BufferedImage/TYPE_BYTE_BINARY) 1.17 + 1.18 1.19 -(defn visualize [points] 1.20 + 1.21 + )) 1.22 + 1.23 + 1.24 + 1.25 + 1.26 +;;(defn visualize [points] 1.27 1.28 1.29