diff org/touch.org @ 231:e29dd0024a9e

reorganized touch
author Robert McIntyre <rlm@mit.edu>
date Sat, 11 Feb 2012 19:32:21 -0700
parents f9b7d674aed8
children b7762699eeb5
line wrap: on
line diff
     1.1 --- a/org/touch.org	Sat Feb 11 19:28:36 2012 -0700
     1.2 +++ b/org/touch.org	Sat Feb 11 19:32:21 2012 -0700
     1.3 @@ -52,6 +52,7 @@
     1.4  stored under the key "scale". If the pixel is gray then the resultant
     1.5  hair length is linearly interpolated between 0 and =scale=.
     1.6  
     1.7 +#+name: meta-data
     1.8  #+begin_src clojure
     1.9  (defn tactile-sensor-profile
    1.10    "Return the touch-sensor distribution image in BufferedImage format,
    1.11 @@ -78,6 +79,7 @@
    1.12  =(triangle-UV-coord)= returns the the UV coordinates of the verticies
    1.13  of a triangle.
    1.14  
    1.15 +#+name: triangles-1
    1.16  #+begin_src clojure
    1.17  (defn triangles
    1.18    "Return a sequence of all the Triangles which compose a given
    1.19 @@ -137,6 +139,7 @@
    1.20  functions make this easy. If these classes implemented =Iterable= then
    1.21  this code would not be necessary. Hopefully they will in the future.
    1.22  
    1.23 +#+name: triangles-2
    1.24  #+begin_src clojure
    1.25  (defn triangle-seq [#^Triangle tri]
    1.26    [(.get1 tri) (.get2 tri) (.get3 tri)])
    1.27 @@ -177,6 +180,7 @@
    1.28  for translating any coordinate within the UV triangle to the
    1.29  cooresponding coordinate in the XYZ triangle.
    1.30  
    1.31 +#+name: triangles-3
    1.32  #+begin_src clojure
    1.33  (defn triangle->matrix4f
    1.34    "Converts the triangle into a 4x4 matrix: The first three columns
    1.35 @@ -214,6 +218,7 @@
    1.36  =(inside-triangle?)=, which determines whether a point is inside a
    1.37  triangle in 2D UV-space.
    1.38  
    1.39 +#+name: triangles-4
    1.40  #+begin_src clojure
    1.41  (defn convex-bounds
    1.42    "Returns the smallest square containing the given vertices, as a
    1.43 @@ -256,6 +261,7 @@
    1.44  location of each touch sensor from pixel coordinates to UV-coordinates
    1.45  and XYZ-coordinates.
    1.46  
    1.47 +#+name: sensors
    1.48  #+begin_src clojure
    1.49  (defn sensors-in-triangle
    1.50    "Locate the touch sensors in the triangle, returning a map of their
    1.51 @@ -309,6 +315,7 @@
    1.52  The "hairs" are actually rays which extend  from a point on a
    1.53  =Triangle= in the =Mesh= normal to the =Triangle's= surface.
    1.54  
    1.55 +#+name: rays
    1.56  #+begin_src clojure
    1.57  (defn get-ray-origin
    1.58    "Return the origin which a Ray would have to have to be in the exact
    1.59 @@ -335,7 +342,7 @@
    1.60  
    1.61  
    1.62  * Skin Creation
    1.63 -
    1.64 +#+name: kernel
    1.65  #+begin_src clojure
    1.66  (defn touch-fn
    1.67    "Returns a function which returns tactile sensory data when called
    1.68 @@ -393,7 +400,7 @@
    1.69  #+end_src
    1.70  
    1.71  * Visualizing Touch
    1.72 -
    1.73 +#+name: visualization
    1.74  #+begin_src clojure
    1.75  (defn view-touch 
    1.76    "Creates a function which accepts a list of  touch sensor-data and
    1.77 @@ -411,6 +418,8 @@
    1.78  #+end_src
    1.79  
    1.80  * Headers 
    1.81 +
    1.82 +#+name: touch-header
    1.83  #+begin_src clojure
    1.84  (ns cortex.touch
    1.85    "Simulate the sense of touch in jMonkeyEngine3. Enables any Geometry
    1.86 @@ -434,7 +443,16 @@
    1.87  
    1.88  * COMMENT Code Generation
    1.89  #+begin_src clojure :tangle ../src/cortex/touch.clj
    1.90 -<<skin-main>>
    1.91 +<<touch-header>>
    1.92 +<<meta-data>>
    1.93 +<<triangles-1>>
    1.94 +<<triangles-2>>
    1.95 +<<triangles-3>>
    1.96 +<<triangles-4>>
    1.97 +<<sensors>>
    1.98 +<<rays>>
    1.99 +<<kernel>>
   1.100 +<<visualization>>
   1.101  #+end_src
   1.102  
   1.103  #+begin_src clojure :tangle ../src/cortex/test/touch.clj