# HG changeset patch # User Robert McIntyre # Date 1329062747 25200 # Node ID 712bd7e5b148a368ce1224af4e858b3ea68e8527 # Parent f27c9fd9134dcce3d484d319ae06da731a7974b1 saving progress diff -r f27c9fd9134d -r 712bd7e5b148 org/ideas.org --- a/org/ideas.org Sun Feb 12 06:21:30 2012 -0700 +++ b/org/ideas.org Sun Feb 12 09:05:47 2012 -0700 @@ -96,13 +96,17 @@ representation -- week - [ ] show sensor maps in HUD display? -- 4 days - [ ] show sensor maps in AWT display? -- 2 days - - [ ] add iteraterator constructs to Vector3f, Vector2f, etc. - [ ] upgrade to clojure 1.3, replace all defvars with new def - - [ ] get Vector3f, Triangle to implement iterable +* jMonkeyEngine ideas + - [ ] video showing bullet joints problem + - [ ] add mult for Matrix to Ray + - [ ] add iteraterator constructs to Vector3f, Vector2f, Triangle, + Matrix3f, Matrix4f, etc + ;;In the elder days of Art, ;;Builders wrought with greatest care ;;Each minute and unseen part; diff -r f27c9fd9134d -r 712bd7e5b148 org/touch.org --- a/org/touch.org Sun Feb 12 06:21:30 2012 -0700 +++ b/org/touch.org Sun Feb 12 09:05:47 2012 -0700 @@ -74,12 +74,57 @@ ** TODO add image showing example touch-uv map ** TODO add metadata display for worm + * Skin Creation +* TODO get the actual lengths for each hair + +#+begin_src clojure +pixel-triangles + xyz-triangles + conversions (map triangles->affine-transform pixel-triangles + xyz-triangles) + +#+end_src + #+name: kernel #+begin_src clojure (in-ns 'cortex.touch) +(declare touch-topology touch-hairs set-ray) + (defn touch-kernel + "Constructs a function which will return tactile sensory data from + 'geo when called from inside a running simulation" + [#^Geometry geo] + (let [[ray-reference-origins + ray-reference-tips + ray-lengths] (touch-hairs geo) + current-rays (map (fn [] (Ray.)) ray-reference-origins) + topology (touch-topology geo)] + (if (empty? ray-reference-origins) nil + (fn [node] + (let [transform (.getWorldMatrix geo)] + (dorun + (map (fn [ray ref-origin ref-tip length] + (set-ray ray transform ref-origin ref-tip length)) + current-rays ray-reference-origins + ray-reference-tips ray-lengths)) + (vector + topology + (vec + (for [ray current-rays] + (do + (let [results (CollisionResults.)] + (.collideWith node ray results) + (let [touch-objects + (filter #(not (= geo (.getGeometry %))) + results)] + [(if (empty? touch-objects) + (.getLimit ray) + (.getDistance (first touch-objects))) + (.getLimit ray)]))))))))))) + +(defn touch-kernel* "Returns a function which returns tactile sensory data when called inside a running simulation." [#^Geometry geo] @@ -348,7 +393,6 @@ #+end_src - * Sensor Related Functions These functions analyze the touch-sensor-profile image convert the @@ -406,7 +450,7 @@ * Physics Collision Objects -The "hairs" are actually rays which extend from a point on a +The "hairs" are actually =Rays= which extend from a point on a =Triangle= in the =Mesh= normal to the =Triangle's= surface. #+name: rays @@ -433,9 +477,6 @@ (.add (.getCenter tri) (.getNormal tri)) n+c) (.subtract n+c (get-ray-origin geom tri)))) #+end_src - - - * Headers #+name: touch-header @@ -478,7 +519,6 @@ (fn [world tpf] (touch-display (map #(% (.getRootNode world)) touch)))))) #+end_src - * Source Listing * Next