Mercurial > cortex
comparison org/touch.org @ 246:63da037ce1c5
added image
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 12 Feb 2012 14:40:58 -0700 |
parents | 102ac596cc3f |
children | 4e220c8fb1ed |
comparison
equal
deleted
inserted
replaced
245:102ac596cc3f | 246:63da037ce1c5 |
---|---|
37 Touch, I use jMonkeyEngine's physics system to execute many small | 37 Touch, I use jMonkeyEngine's physics system to execute many small |
38 collision detections, one for each "hair". The placement of the | 38 collision detections, one for each "hair". The placement of the |
39 "hairs" is determined by a UV-mapped image which shows where each hair | 39 "hairs" is determined by a UV-mapped image which shows where each hair |
40 should be on the 3D surface of the body. | 40 should be on the 3D surface of the body. |
41 | 41 |
42 | |
43 * Defining Touch Meta-Data in Blender | 42 * Defining Touch Meta-Data in Blender |
44 | 43 |
45 Each geometry can have a single UV map which describes the position of | 44 Each geometry can have a single UV map which describes the position of |
46 the "hairs" which will constitute its sense of touch. This image path | 45 the "hairs" which will constitute its sense of touch. This image path |
47 is stored under the "touch" key. The image itself is black and white, | 46 is stored under the "touch" key. The image itself is black and white, |
66 [#^Geometry obj] | 65 [#^Geometry obj] |
67 (if-let [scale (meta-data obj "scale")] | 66 (if-let [scale (meta-data obj "scale")] |
68 scale 0.1)) | 67 scale 0.1)) |
69 #+end_src | 68 #+end_src |
70 | 69 |
71 ** TODO add image showing example touch-uv map | 70 Here is an example of a UV-map which specifies the position of touch |
72 ** TODO add metadata display for worm | 71 sensors along the surface of the worm. |
73 | 72 |
73 #+attr_html: width=755 | |
74 #+caption: This is the tactile-sensor-profile for the upper segment of the worm. It defines regions of high touch sensitivity (where there are many white pixels) and regions of low sensitivity (where white pixels are sparse). | |
75 [[../images/finger-UV.png]] | |
74 | 76 |
75 * Skin Creation | 77 * Skin Creation |
76 | 78 |
77 =(touch-kernel)= generates the functions which implement the sense of | 79 =(touch-kernel)= generates the functions which implement the sense of |
78 touch for a creature. These functions must do 6 things to obtain touch | 80 touch for a creature. These functions must do 6 things to obtain touch |
228 (defn view-touch | 230 (defn view-touch |
229 "Creates a function which accepts a list of touch sensor-data and | 231 "Creates a function which accepts a list of touch sensor-data and |
230 displays each element to the screen." | 232 displays each element to the screen." |
231 [] | 233 [] |
232 (view-sense | 234 (view-sense |
233 (fn | 235 (fn [[coords sensor-data]] |
234 [[coords sensor-data]] | |
235 (let [image (points->image coords)] | 236 (let [image (points->image coords)] |
236 (dorun | 237 (dorun |
237 (for [i (range (count coords))] | 238 (for [i (range (count coords))] |
238 (.setRGB image ((coords i) 0) ((coords i) 1) | 239 (.setRGB image ((coords i) 0) ((coords i) 1) |
239 (apply touch->gray (sensor-data i))))) | 240 (apply touch->gray (sensor-data i))))) image)))) |
240 image)))) | |
241 #+end_src | 241 #+end_src |
242 | 242 |
243 | 243 |
244 | 244 |
245 * Triangle Manipulation Functions | 245 * Triangle Manipulation Functions |
368 It is convienent to treat a =Triangle= as a sequence of verticies, and | 368 It is convienent to treat a =Triangle= as a sequence of verticies, and |
369 a =Vector2f= and =Vector3f= as a sequence of floats. These conversion | 369 a =Vector2f= and =Vector3f= as a sequence of floats. These conversion |
370 functions make this easy. If these classes implemented =Iterable= then | 370 functions make this easy. If these classes implemented =Iterable= then |
371 this code would not be necessary. Hopefully they will in the future. | 371 this code would not be necessary. Hopefully they will in the future. |
372 | 372 |
373 | |
374 * Triangle Boundaries | 373 * Triangle Boundaries |
375 | 374 |
376 For efficiency's sake I will divide the UV-image into small squares | 375 For efficiency's sake I will divide the UV-image into small squares |
377 which inscribe each UV-triangle, then extract the points which lie | 376 which inscribe each UV-triangle, then extract the points which lie |
378 inside the triangle and map them to 3D-space using | 377 inside the triangle and map them to 3D-space using |
459 (fn [world] | 458 (fn [world] |
460 (speed-up world) | 459 (speed-up world) |
461 (light-up-everything world)) | 460 (light-up-everything world)) |
462 | 461 |
463 (fn [world tpf] | 462 (fn [world tpf] |
464 (touch-display (map #(% (.getRootNode world)) touch)) | 463 (touch-display |
465 )))) | 464 (map #(% (.getRootNode world)) touch)))))) |
466 #+end_src | 465 #+end_src |
467 * Source Listing | 466 * Source Listing |
468 * Next | 467 * Next |
469 | 468 |
470 | 469 |