# HG changeset patch # User Robert McIntyre # Date 1329082432 25200 # Node ID 102ac596cc3f61a308d9b0f79ea6b71891e9e49b # Parent f23217324f7298fd0f208fd36106efc37e9fa3e5 minor formatting changes diff -r f23217324f72 -r 102ac596cc3f org/touch.org --- a/org/touch.org Sun Feb 12 14:29:09 2012 -0700 +++ b/org/touch.org Sun Feb 12 14:33:52 2012 -0700 @@ -42,14 +42,12 @@ * Defining Touch Meta-Data in Blender -Each geometry can have a single UV map which describes the position -and length of the "hairs" which will constitute its sense of -touch. This image path is stored under the "touch" key. The image -itself is grayscale, with black meaning a hair length of 0 (no hair is -present) and white meaning a hair length of =scale=, which is a float -stored under the key "scale". If the pixel is gray then the resultant -hair length is linearly interpolated between 0 and =scale=. I call -these "hairs" /feelers/. +Each geometry can have a single UV map which describes the position of +the "hairs" which will constitute its sense of touch. This image path +is stored under the "touch" key. The image itself is black and white, +with black meaning a hair length of 0 (no hair is present) and white +meaning a hair length of =scale=, which is a float stored under the +key "scale". I call these "hairs" /feelers/. #+name: meta-data #+begin_src clojure @@ -75,8 +73,6 @@ * Skin Creation -* TODO get the actual lengths for each feeler - =(touch-kernel)= generates the functions which implement the sense of touch for a creature. These functions must do 6 things to obtain touch @@ -86,10 +82,6 @@ the layout of feelers along the object's surface. =(tactile-sensor-profile)=, =(tactile-scale)= - - Get the lengths of each feeler by analyzing the color of the - pixels in the tactile profile image. - NOT IMPLEMENTED YET - - Find the triangles which make up the mesh in pixel-space and in world-space. =(triangles)= =(pixel-triangles)= @@ -114,8 +106,6 @@ #+begin_src clojure (in-ns 'cortex.touch) -(declare touch-topology feelers set-ray) - (defn set-ray [#^Ray ray #^Matrix4f transform #^Vector3f origin #^Vector3f tip] ;; Doing everything locally recduces garbage collection by enough to @@ -171,9 +161,6 @@ (node-seq creature))))) #+end_src -#+results: kernel -: #'cortex.touch/touch! - * Sensor Related Functions These functions analyze the touch-sensor-profile image convert the @@ -223,7 +210,6 @@ (mapcat (fn [origins normal] (map #(.add % normal) origins)) world-coords normals))) - (defn touch-topology [#^Geometry geo image] (collapse (reduce concat (feeler-pixel-coords geo image)))) @@ -235,17 +221,12 @@ (in-ns 'cortex.touch) (defn touch->gray - "Convert a pair of [distance, max-distance] into a grayscale pixel" + "Convert a pair of [distance, max-distance] into a grayscale pixel." [distance max-distance] - (gray - (- 255 - (rem - (int - (* 255 (/ distance max-distance))) - 256)))) + (gray (- 255 (rem (int (* 255 (/ distance max-distance))) 256)))) (defn view-touch - "Creates a function which accepts a list of touch sensor-data and + "Creates a function which accepts a list of touch sensor-data and displays each element to the screen." [] (view-sense @@ -295,8 +276,7 @@ (apply #(Triangle. %1 %2 %3) (map ->vector3f points))) (defn triangle - "Get the triangle specified by triangle-index from the mesh within - bounds." + "Get the triangle specified by triangle-index from the mesh." [#^Geometry geo triangle-index] (triangle-seq (let [scratch (Triangle.)] @@ -370,8 +350,7 @@ (for [row (range 4) col (range 3)] (do (.set mat col row (.get (vertices row)col)) - (.set mat 3 row 1)))) - mat)) + (.set mat 3 row 1)))) mat)) (defn triangles->affine-transform "Returns the affine transformation that converts each vertex in the