comparison org/test-creature.org @ 103:85ee8bb80edf

can now visuliaze touch data
author Robert McIntyre <rlm@mit.edu>
date Sat, 14 Jan 2012 21:15:44 -0700
parents 7eeb940bcbc8
children ee302b65213b
comparison
equal deleted inserted replaced
102:7eeb940bcbc8 103:85ee8bb80edf
6 #+SETUPFILE: ../../aurellem/org/setup.org 6 #+SETUPFILE: ../../aurellem/org/setup.org
7 #+INCLUDE: ../../aurellem/org/level-0.org 7 #+INCLUDE: ../../aurellem/org/level-0.org
8 8
9 9
10 * objectives 10 * objectives
11 - [ ] get an overall bitmap-like image for touch 11 - [X] get an overall bitmap-like image for touch
12 - [ ] write code to visuliaze this bitmap 12 - [X] write code to visuliaze this bitmap
13 - [ ] directly change the UV-pixels to show touch sensor activation 13 - [ ] directly change the UV-pixels to show touch sensor activation
14 - [ ] write an explination for why b&w bitmaps for senses is appropiate 14 - [ ] write an explination for why b&w bitmaps for senses is appropiate
15 - [ ] clean up touch code and write visulazation test 15 - [ ] clean up touch code and write visulazation test
16 - [ ] do the same for eyes 16 - [ ] do the same for eyes
17 17
745 (defn touch [#^Node pieces] 745 (defn touch [#^Node pieces]
746 (map enable-touch 746 (map enable-touch
747 (filter #(isa? (class %) Geometry) 747 (filter #(isa? (class %) Geometry)
748 (node-seq pieces)))) 748 (node-seq pieces))))
749 749
750 750 (defn debug-window
751 "creates function that offers a debug view of sensor data"
752 []
753 (let [vi (view-image)]
754 (fn
755 [[coords sensor-data]]
756 (let [image (points->image coords)]
757 (dorun
758 (for [i (range (count coords))]
759 (.setRGB image ((coords i) 0) ((coords i) 1)
760 ({0 -16777216
761 1 -1} (sensor-data i)))))
762 (vi image)))))
763
764
751 (defn all-names [] 765 (defn all-names []
752 (concat 766 (concat
753 (re-split #"\n" (slurp (file-str 767 (re-split #"\n" (slurp (file-str
754 "/home/r/proj/names/dist.female.first"))) 768 "/home/r/proj/names/dist.female.first")))
755 (re-split #"\n" (slurp (file-str 769 (re-split #"\n" (slurp (file-str