Mercurial > cortex
diff org/touch.org @ 245:102ac596cc3f
minor formatting changes
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 12 Feb 2012 14:33:52 -0700 |
parents | f23217324f72 |
children | 63da037ce1c5 |
line wrap: on
line diff
1.1 --- a/org/touch.org Sun Feb 12 14:29:09 2012 -0700 1.2 +++ b/org/touch.org Sun Feb 12 14:33:52 2012 -0700 1.3 @@ -42,14 +42,12 @@ 1.4 1.5 * Defining Touch Meta-Data in Blender 1.6 1.7 -Each geometry can have a single UV map which describes the position 1.8 -and length of the "hairs" which will constitute its sense of 1.9 -touch. This image path is stored under the "touch" key. The image 1.10 -itself is grayscale, with black meaning a hair length of 0 (no hair is 1.11 -present) and white meaning a hair length of =scale=, which is a float 1.12 -stored under the key "scale". If the pixel is gray then the resultant 1.13 -hair length is linearly interpolated between 0 and =scale=. I call 1.14 -these "hairs" /feelers/. 1.15 +Each geometry can have a single UV map which describes the position of 1.16 +the "hairs" which will constitute its sense of touch. This image path 1.17 +is stored under the "touch" key. The image itself is black and white, 1.18 +with black meaning a hair length of 0 (no hair is present) and white 1.19 +meaning a hair length of =scale=, which is a float stored under the 1.20 +key "scale". I call these "hairs" /feelers/. 1.21 1.22 #+name: meta-data 1.23 #+begin_src clojure 1.24 @@ -75,8 +73,6 @@ 1.25 1.26 1.27 * Skin Creation 1.28 -* TODO get the actual lengths for each feeler 1.29 - 1.30 1.31 =(touch-kernel)= generates the functions which implement the sense of 1.32 touch for a creature. These functions must do 6 things to obtain touch 1.33 @@ -86,10 +82,6 @@ 1.34 the layout of feelers along the object's surface. 1.35 =(tactile-sensor-profile)=, =(tactile-scale)= 1.36 1.37 - - Get the lengths of each feeler by analyzing the color of the 1.38 - pixels in the tactile profile image. 1.39 - NOT IMPLEMENTED YET 1.40 - 1.41 - Find the triangles which make up the mesh in pixel-space and in 1.42 world-space. 1.43 =(triangles)= =(pixel-triangles)= 1.44 @@ -114,8 +106,6 @@ 1.45 #+begin_src clojure 1.46 (in-ns 'cortex.touch) 1.47 1.48 -(declare touch-topology feelers set-ray) 1.49 - 1.50 (defn set-ray [#^Ray ray #^Matrix4f transform 1.51 #^Vector3f origin #^Vector3f tip] 1.52 ;; Doing everything locally recduces garbage collection by enough to 1.53 @@ -171,9 +161,6 @@ 1.54 (node-seq creature))))) 1.55 #+end_src 1.56 1.57 -#+results: kernel 1.58 -: #'cortex.touch/touch! 1.59 - 1.60 * Sensor Related Functions 1.61 1.62 These functions analyze the touch-sensor-profile image convert the 1.63 @@ -223,7 +210,6 @@ 1.64 (mapcat (fn [origins normal] 1.65 (map #(.add % normal) origins)) 1.66 world-coords normals))) 1.67 - 1.68 1.69 (defn touch-topology [#^Geometry geo image] 1.70 (collapse (reduce concat (feeler-pixel-coords geo image)))) 1.71 @@ -235,17 +221,12 @@ 1.72 (in-ns 'cortex.touch) 1.73 1.74 (defn touch->gray 1.75 - "Convert a pair of [distance, max-distance] into a grayscale pixel" 1.76 + "Convert a pair of [distance, max-distance] into a grayscale pixel." 1.77 [distance max-distance] 1.78 - (gray 1.79 - (- 255 1.80 - (rem 1.81 - (int 1.82 - (* 255 (/ distance max-distance))) 1.83 - 256)))) 1.84 + (gray (- 255 (rem (int (* 255 (/ distance max-distance))) 256)))) 1.85 1.86 (defn view-touch 1.87 - "Creates a function which accepts a list of touch sensor-data and 1.88 + "Creates a function which accepts a list of touch sensor-data and 1.89 displays each element to the screen." 1.90 [] 1.91 (view-sense 1.92 @@ -295,8 +276,7 @@ 1.93 (apply #(Triangle. %1 %2 %3) (map ->vector3f points))) 1.94 1.95 (defn triangle 1.96 - "Get the triangle specified by triangle-index from the mesh within 1.97 - bounds." 1.98 + "Get the triangle specified by triangle-index from the mesh." 1.99 [#^Geometry geo triangle-index] 1.100 (triangle-seq 1.101 (let [scratch (Triangle.)] 1.102 @@ -370,8 +350,7 @@ 1.103 (for [row (range 4) col (range 3)] 1.104 (do 1.105 (.set mat col row (.get (vertices row)col)) 1.106 - (.set mat 3 row 1)))) 1.107 - mat)) 1.108 + (.set mat 3 row 1)))) mat)) 1.109 1.110 (defn triangles->affine-transform 1.111 "Returns the affine transformation that converts each vertex in the