changeset 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
files org/test-creature.org
diffstat 1 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/org/test-creature.org	Sat Jan 14 20:44:13 2012 -0700
     1.2 +++ b/org/test-creature.org	Sat Jan 14 21:15:44 2012 -0700
     1.3 @@ -8,8 +8,8 @@
     1.4  
     1.5  
     1.6  * objectives
     1.7 - - [ ] get an overall bitmap-like image for touch
     1.8 - - [ ] write code to visuliaze this bitmap
     1.9 + - [X] get an overall bitmap-like image for touch
    1.10 + - [X] write code to visuliaze this bitmap
    1.11   - [ ] directly change the UV-pixels to show touch sensor activation
    1.12   - [ ] write an explination for why b&w bitmaps for senses is appropiate
    1.13   - [ ] clean up touch code and write visulazation test
    1.14 @@ -747,7 +747,21 @@
    1.15         (filter #(isa? (class %) Geometry)
    1.16                 (node-seq pieces))))
    1.17  
    1.18 -    
    1.19 +(defn debug-window
    1.20 +  "creates function that offers a debug view of sensor data"
    1.21 +  []
    1.22 +  (let [vi (view-image)]
    1.23 +    (fn 
    1.24 +      [[coords sensor-data]]
    1.25 +      (let [image (points->image coords)]
    1.26 +        (dorun
    1.27 +         (for [i (range (count coords))]
    1.28 +           (.setRGB image ((coords i) 0) ((coords i) 1)
    1.29 +                    ({0 -16777216
    1.30 +                      1 -1} (sensor-data i)))))
    1.31 +        (vi image)))))
    1.32 +
    1.33 +
    1.34  (defn all-names []
    1.35    (concat 
    1.36     (re-split #"\n" (slurp (file-str