# HG changeset patch # User Robert McIntyre # Date 1396061474 14400 # Node ID ba54df21fc7c4725ba77536769fc2099a993640f # Parent 5a15611fbb9fd98961d24ad93416f1aacbe6e9d3 complete first draft of touch. diff -r 5a15611fbb9f -r ba54df21fc7c thesis/cortex.org --- a/thesis/cortex.org Fri Mar 28 22:09:03 2014 -0400 +++ b/thesis/cortex.org Fri Mar 28 22:51:14 2014 -0400 @@ -1554,7 +1554,7 @@ jMonkeyEngine3 community and is used to record audio for demo videos. -** Touch uses hundreds of hair-like elements +** COMMENT Touch uses hundreds of hair-like elements Touch is critical to navigation and spatial reasoning and as such I need a simulated version of it to give to my AI creatures. @@ -1588,7 +1588,7 @@ of the feelers is determined by a UV-mapped image which shows where each feeler should be on the 3D surface of the body. -*** COMMENT Defining Touch Meta-Data in Blender +*** Defining Touch Meta-Data in Blender Each geometry can have a single UV map which describes the position of the feelers which will constitute its sense of touch. @@ -1602,6 +1602,7 @@ #+caption: creature's body is sufficient. #+name: touch-meta-data #+begin_listing clojure + #+BEGIN_SRC clojure (defn tactile-sensor-profile "Return the touch-sensor distribution image in BufferedImage format, or nil if it does not exist." @@ -1615,21 +1616,21 @@ [#^Geometry obj] (if-let [scale (meta-data obj "scale")] scale 0.1)) + #+END_SRC #+end_listing Here is an example of a UV-map which specifies the position of touch sensors along the surface of the upper segment of a fingertip. - #+caption: This is the tactile-sensor-profile for the upper segment #+caption: of a fingertip. It defines regions of high touch sensitivity #+caption: (where there are many white pixels) and regions of low #+caption: sensitivity (where white pixels are sparse). #+name: fimgertip-UV - #+ATTR_LaTeX: :width 10cm - [[../images/finger-UV.png]] + #+ATTR_LaTeX: :width 13cm + [[./images/finger-UV.png]] -*** COMMENT Implementation Summary +*** Implementation Summary To simulate touch there are three conceptual steps. For each solid object in the creature, you first have to get UV image and scale @@ -1657,7 +1658,7 @@ normalized coordinates of the tips of the feelers. (=feeler-tips=). -*** COMMENT Triangle Math +*** Triangle Math The rigid objects which make up a creature have an underlying =Geometry=, which is a =Mesh= plus a =Material= and other @@ -1675,6 +1676,7 @@ #+caption: their verticies in both world and UV-coordinates. #+name: get-triangles #+begin_listing clojure + #+BEGIN_SRC clojure (defn triangle "Get the triangle specified by triangle-index from the mesh." [#^Geometry geo triangle-index] @@ -1723,6 +1725,7 @@ width (.getWidth image)] (map (partial pixel-triangle geo image) (range (.getTriangleCount (.getMesh geo)))))) + #+END_SRC #+end_listing *** The Affine Transform from one Triangle to Another @@ -1796,7 +1799,7 @@ #+END_SRC #+end_listing -*** COMMENT Triangle Boundaries +*** Triangle Boundaries For efficiency's sake I will divide the tactile-profile image into small squares which inscribe each pixel-triangle, then extract the @@ -1847,7 +1850,7 @@ #+END_SRC #+end_listing -*** COMMENT Feeler Coordinates +*** Feeler Coordinates The triangle-related functions above make short work of calculating the positions and orientations of each feeler in @@ -1919,7 +1922,7 @@ #+END_SRC #+end_listing -*** COMMENT Simulated Touch +*** Simulated Touch Now that the functions to construct feelers are complete, =touch-kernel= generates functions to be called from within a