changeset 234:712bd7e5b148

saving progress
author Robert McIntyre <rlm@mit.edu>
date Sun, 12 Feb 2012 09:05:47 -0700
parents f27c9fd9134d
children be78d7bd6920
files org/ideas.org org/touch.org
diffstat 2 files changed, 52 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/org/ideas.org	Sun Feb 12 06:21:30 2012 -0700
     1.2 +++ b/org/ideas.org	Sun Feb 12 09:05:47 2012 -0700
     1.3 @@ -96,13 +96,17 @@
     1.4         representation -- week
     1.5   - [ ] show sensor maps in HUD display? -- 4 days
     1.6   - [ ] show sensor maps in AWT display? -- 2 days
     1.7 - - [ ] add iteraterator constructs to Vector3f, Vector2f, etc.
     1.8   - [ ] upgrade to clojure 1.3, replace all defvars with new def
     1.9 - - [ ] get Vector3f, Triangle to implement iterable
    1.10  
    1.11  
    1.12  
    1.13  
    1.14 +* jMonkeyEngine ideas
    1.15 + - [ ] video showing bullet joints problem
    1.16 + - [ ] add mult for Matrix to Ray
    1.17 + - [ ] add iteraterator constructs to Vector3f, Vector2f, Triangle,
    1.18 +   Matrix3f, Matrix4f, etc
    1.19 +
    1.20  ;;In the elder days of Art,
    1.21  ;;Builders wrought with greatest care
    1.22  ;;Each minute and unseen part;
     2.1 --- a/org/touch.org	Sun Feb 12 06:21:30 2012 -0700
     2.2 +++ b/org/touch.org	Sun Feb 12 09:05:47 2012 -0700
     2.3 @@ -74,12 +74,57 @@
     2.4  ** TODO add image showing example touch-uv map
     2.5  ** TODO add metadata display for worm
     2.6  
     2.7 +
     2.8  * Skin Creation
     2.9 +* TODO get the actual lengths for each hair
    2.10 +
    2.11 +#+begin_src clojure
    2.12 +pixel-triangles
    2.13 +        xyz-triangles
    2.14 +        conversions (map triangles->affine-transform pixel-triangles
    2.15 +                         xyz-triangles)
    2.16 +
    2.17 +#+end_src
    2.18 +
    2.19  #+name: kernel
    2.20  #+begin_src clojure
    2.21  (in-ns 'cortex.touch)
    2.22  
    2.23 +(declare touch-topology touch-hairs set-ray)
    2.24 +
    2.25  (defn touch-kernel
    2.26 +  "Constructs a function which will return tactile sensory data from
    2.27 +   'geo when called from inside a running simulation"
    2.28 +  [#^Geometry geo]
    2.29 +  (let [[ray-reference-origins
    2.30 +         ray-reference-tips
    2.31 +         ray-lengths] (touch-hairs geo)
    2.32 +        current-rays (map (fn [] (Ray.)) ray-reference-origins)
    2.33 +        topology (touch-topology geo)]
    2.34 +    (if (empty? ray-reference-origins) nil
    2.35 +        (fn [node]
    2.36 +          (let [transform (.getWorldMatrix geo)]
    2.37 +            (dorun
    2.38 +             (map (fn [ray ref-origin ref-tip length]
    2.39 +                    (set-ray ray transform ref-origin ref-tip length))
    2.40 +                  current-rays ray-reference-origins
    2.41 +                  ray-reference-tips ray-lengths))
    2.42 +            (vector
    2.43 +             topology
    2.44 +             (vec
    2.45 +              (for [ray current-rays]
    2.46 +                (do
    2.47 +                  (let [results (CollisionResults.)]
    2.48 +                    (.collideWith node ray results)
    2.49 +                    (let [touch-objects
    2.50 +                          (filter #(not (= geo (.getGeometry %)))
    2.51 +                                  results)]
    2.52 +                      [(if (empty? touch-objects)
    2.53 +                         (.getLimit ray)
    2.54 +                         (.getDistance (first touch-objects)))
    2.55 +                       (.getLimit ray)])))))))))))
    2.56 +
    2.57 +(defn touch-kernel*
    2.58    "Returns a function which returns tactile sensory data when called
    2.59     inside a running simulation."
    2.60    [#^Geometry geo]
    2.61 @@ -348,7 +393,6 @@
    2.62  #+end_src
    2.63  
    2.64  
    2.65 -
    2.66  * Sensor Related Functions
    2.67  
    2.68  These functions analyze the touch-sensor-profile image convert the
    2.69 @@ -406,7 +450,7 @@
    2.70  
    2.71  * Physics Collision Objects
    2.72  
    2.73 -The "hairs" are actually rays which extend  from a point on a
    2.74 +The "hairs" are actually =Rays= which extend  from a point on a
    2.75  =Triangle= in the =Mesh= normal to the =Triangle's= surface.
    2.76  
    2.77  #+name: rays
    2.78 @@ -433,9 +477,6 @@
    2.79       (.add (.getCenter tri) (.getNormal tri)) n+c)
    2.80      (.subtract n+c (get-ray-origin geom tri))))
    2.81  #+end_src
    2.82 -
    2.83 -
    2.84 -
    2.85  * Headers 
    2.86  
    2.87  #+name: touch-header
    2.88 @@ -478,7 +519,6 @@
    2.89             (fn [world tpf]
    2.90               (touch-display (map #(% (.getRootNode world)) touch))))))
    2.91  #+end_src
    2.92 -
    2.93  * Source Listing
    2.94  * Next
    2.95