Mercurial > cortex
comparison 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 |
comparison
equal
deleted
inserted
replaced
99:b7a3ba5e879b | 100:940074adc1d5 |
---|---|
92 (fn [#^BufferedImage i] | 92 (fn [#^BufferedImage i] |
93 (reset! image i) | 93 (reset! image i) |
94 (.setSize frame (+ 8 (.getWidth i)) (+ 28 (.getHeight i))) | 94 (.setSize frame (+ 8 (.getWidth i)) (+ 28 (.getHeight i))) |
95 (.repaint panel 0 0 (.getWidth i) (.getHeight i))))) | 95 (.repaint panel 0 0 (.getWidth i) (.getHeight i))))) |
96 | 96 |
97 | 97 (defn points->image |
98 (defn visualize [points] | 98 "Take a sparse collection of points and visuliaze it as a |
99 BufferedImage." | |
100 [points] | |
101 (let [xs (map first points) | |
102 ys (map second points) | |
103 width (- (apply max xs) (apply min xs)) | |
104 height (- (apply max ys) (apply min ys)) | |
105 image (BufferedImage. width height | |
106 BufferedImage/TYPE_BYTE_BINARY) | |
107 | |
108 | |
109 | |
110 )) | |
111 | |
112 | |
113 | |
114 | |
115 ;;(defn visualize [points] | |
99 | 116 |
100 | 117 |
101 | 118 |
102 (defn collapse | 119 (defn collapse |
103 "Take a set of pairs of integers and collapse them into a | 120 "Take a set of pairs of integers and collapse them into a |