# HG changeset patch # User Robert McIntyre # Date 1329082149 25200 # Node ID f23217324f7298fd0f208fd36106efc37e9fa3e5 # Parent f33fec68f775365735e4d1a464b037b52d8e8775 changed semantics of feeler lengths diff -r f33fec68f775 -r f23217324f72 org/touch.org --- a/org/touch.org Sun Feb 12 14:14:57 2012 -0700 +++ b/org/touch.org Sun Feb 12 14:29:09 2012 -0700 @@ -6,8 +6,6 @@ #+SETUPFILE: ../../aurellem/org/setup.org #+INCLUDE: ../../aurellem/org/level-0.org - - * Touch Touch is critical to navigation and spatial reasoning and as such I @@ -118,15 +116,14 @@ (declare touch-topology feelers set-ray) -(defn set-ray [#^Ray ray #^Matrix4f transform #^Vector3f origin - #^Vector3f tip length] +(defn set-ray [#^Ray ray #^Matrix4f transform + #^Vector3f origin #^Vector3f tip] ;; Doing everything locally recduces garbage collection by enough to ;; be worth it. (.mult transform origin (.getOrigin ray)) (.mult transform tip (.getDirection ray)) - (.subtractLocal (.getDirection ray) (.getOrigin ray)) - (.setLimit ray length)) + (.subtractLocal (.getDirection ray) (.getOrigin ray))) (defn touch-kernel "Constructs a function which will return tactile sensory data from @@ -136,16 +133,17 @@ [profile (tactile-sensor-profile geo)] (let [ray-reference-origins (feeler-origins geo profile) ray-reference-tips (feeler-tips geo profile) - ray-lengths (repeat 9000 0.1) + ray-length (tactile-scale geo) current-rays (map (fn [_] (Ray.)) ray-reference-origins) topology (touch-topology geo profile)] + (dorun (map #(.setLimit % ray-length) current-rays)) (fn [node] (let [transform (.getWorldMatrix geo)] (dorun - (map (fn [ray ref-origin ref-tip length] - (set-ray ray transform ref-origin ref-tip length)) + (map (fn [ray ref-origin ref-tip] + (set-ray ray transform ref-origin ref-tip)) current-rays ray-reference-origins - ray-reference-tips ray-lengths)) + ray-reference-tips)) (vector topology (vec @@ -480,14 +478,11 @@ standard-debug-controls (fn [world] + (speed-up world) (light-up-everything world)) (fn [world tpf] - - - (dorun (map #(% (.getRootNode world)) touch)) - - + (touch-display (map #(% (.getRootNode world)) touch)) )))) #+end_src * Source Listing