comparison org/touch.org @ 283:23aadf376e9d

upgraded to latest jMonkeyEngine, streamlined tests
author Robert McIntyre <rlm@mit.edu>
date Wed, 15 Feb 2012 16:56:01 -0700
parents c39b8b29a79e
children 7e7f8d6d9ec5
comparison
equal deleted inserted replaced
282:2ad29b68ff22 283:23aadf376e9d
433 (let [response 433 (let [response
434 (apply min (map #(.getDistance %) 434 (apply min (map #(.getDistance %)
435 touch-objects))] 435 touch-objects))]
436 (FastMath/clamp 436 (FastMath/clamp
437 (float 437 (float
438 (if (> response limit) 0.0 438 (if (> response limit) (float 0.0)
439 (+ response correction))) 439 (+ response correction)))
440 (float 0.0) 440 (float 0.0)
441 limit))) 441 limit)))
442 limit]))))))))))) 442 limit])))))))))))
443 443
483 (let [image (points->image coords)] 483 (let [image (points->image coords)]
484 (dorun 484 (dorun
485 (for [i (range (count coords))] 485 (for [i (range (count coords))]
486 (.setRGB image ((coords i) 0) ((coords i) 1) 486 (.setRGB image ((coords i) 0) ((coords i) 1)
487 (apply touch->gray (sensor-data i))))) 487 (apply touch->gray (sensor-data i)))))
488 image)))) 488 image))))
489 #+end_src 489 #+end_src
490 490
491 #+results: visualization 491 #+results: visualization
492 : #'cortex.touch/view-touch 492 : #'cortex.touch/view-touch
493 493
621 621
622 #+name: test-touch-2 622 #+name: test-touch-2
623 #+begin_src clojure 623 #+begin_src clojure
624 (in-ns 'cortex.test.touch) 624 (in-ns 'cortex.test.touch)
625 625
626 (defn test-touch 626 (defn test-worm-touch
627 ([] (test-touch false)) 627 ([] (test-worm-touch false))
628 ([record?] 628 ([record?]
629 (let [the-worm (doto (worm) (body!)) 629 (let [the-worm (doto (worm) (body!))
630 touch (touch! the-worm) 630 touch (touch! the-worm)
631 touch-display (view-touch)] 631 touch-display (view-touch)]
632 (world 632 (world
728 * Source Listing 728 * Source Listing
729 - [[../src/cortex/touch.clj][cortex.touch]] 729 - [[../src/cortex/touch.clj][cortex.touch]]
730 - [[../src/cortex/test/touch.clj][cortex.test.touch]] 730 - [[../src/cortex/test/touch.clj][cortex.test.touch]]
731 - [[../src/cortex/video/magick4.clj][cortex.video.magick4]] 731 - [[../src/cortex/video/magick4.clj][cortex.video.magick4]]
732 - [[../src/cortex/video/magick5.clj][cortex.video.magick5]] 732 - [[../src/cortex/video/magick5.clj][cortex.video.magick5]]
733 - [[../assets/Models/test-touch/touch-cube.blend][touch-cube.blend]]
733 #+html: <ul> <li> <a href="../org/touch.org">This org file</a> </li> </ul> 734 #+html: <ul> <li> <a href="../org/touch.org">This org file</a> </li> </ul>
734 - [[http://hg.bortreb.com ][source-repository]] 735 - [[http://hg.bortreb.com ][source-repository]]
735 736
736 * Next 737 * Next
737 So far I've implemented simulated Vision, Hearing, and Touch, the most 738 So far I've implemented simulated Vision, Hearing, and Touch, the most
779 #+end_src 780 #+end_src
780 781
781 #+begin_src clojure :tangle ../src/cortex/video/magick5.clj 782 #+begin_src clojure :tangle ../src/cortex/video/magick5.clj
782 <<magick5>> 783 <<magick5>>
783 #+end_src 784 #+end_src
784
785
786
787
788
789
790
791