comparison org/skin.org @ 39:2ce7400825c2

further cleanup on touch
author Robert McIntyre <rlm@mit.edu>
date Thu, 03 Nov 2011 10:03:22 -0700
parents eeba17a4bd54
children bc93abad23ee
comparison
equal deleted inserted replaced
38:99971a59b6ac 39:2ce7400825c2
3 #+email: rlm@mit.edu 3 #+email: rlm@mit.edu
4 #+description: Simulated touch for AI research using JMonkeyEngine and clojure. 4 #+description: Simulated touch for AI research using JMonkeyEngine and clojure.
5 #+keywords: simulation, tactile sense, jMonkeyEngine3, clojure 5 #+keywords: simulation, tactile sense, jMonkeyEngine3, clojure
6 #+SETUPFILE: ../../aurellem/org/setup.org 6 #+SETUPFILE: ../../aurellem/org/setup.org
7 #+INCLUDE: ../../aurellem/org/level-0.org 7 #+INCLUDE: ../../aurellem/org/level-0.org
8
8 9
9 * Touch 10 * Touch
10 11
11 My creatures need to be able to feel their environments. The idea here 12 My creatures need to be able to feel their environments. The idea here
12 is to thousands of small /touch receptors/ along the geometries which 13 is to thousands of small /touch receptors/ along the geometries which
24 density of triangles along the surface of the Geometry. Enables a 25 density of triangles along the surface of the Geometry. Enables a
25 Geometry to know what parts of itself are touching nearby objects." 26 Geometry to know what parts of itself are touching nearby objects."
26 {:author "Robert McIntyre"} 27 {:author "Robert McIntyre"}
27 (:use (cortex world util)) 28 (:use (cortex world util))
28 (:import com.jme3.scene.Geometry) 29 (:import com.jme3.scene.Geometry)
29 (:import com.jme3.collision.CollisionResult) 30 (:import com.jme3.collision.CollisionResults)
30 (:import com.jme3.math Triangle Vector3f Ray)) 31 (:import (com.jme3.math Triangle Vector3f Ray)))
31 32
32 (defn triangles 33 (defn triangles
33 "Return a sequence of all the Triangles which compose a given 34 "Return a sequence of all the Triangles which compose a given
34 Geometry." 35 Geometry."
35 [#^Geometry geom] 36 [#^Geometry geom]
102 #+end_src 103 #+end_src
103 104
104 105
105 * Example 106 * Example
106 107
108 #+srcname: touch-test
107 #+begin_src clojure 109 #+begin_src clojure
108 110 (ns test.touch
111 (:use (cortex world util touch)))
112
113 (cortex.import/mega-import-jme3)
109 114
115 (import java.util.logging.Level)
116 (import java.util.logging.Logger)
117 (use 'hello.brick-wall)
118
119
110 (defn ray-origin-debug 120 (defn ray-origin-debug
111 [ray color] 121 [ray color]
112 (make-shape 122 (make-shape
113 (assoc base-shape 123 (assoc base-shape
114 :shape (Sphere. 5 5 0.05) 124 :shape (Sphere. 5 5 0.05)
265 275
266 276
267 277
268 278
269 * COMMENT code generation 279 * COMMENT code generation
270 #+begin_src clojure :tangle ../src/cortex/touch.clj :noweb yes 280 #+begin_src clojure :tangle ../src/cortex/touch.clj
271 <<skin-main>> 281 <<skin-main>>
272 #+end_src 282 #+end_src
273 283
284 #+begin_src clojure :tangle ../src/test/touch.clj
285 <<touch-test>>
286 #+end_src
287
274 288
275 289
276 290
277 291
278 292