Mercurial > cortex
comparison org/movement.org @ 340:4f5a5d5f1613
added time dialation display for test suite.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Jul 2012 11:18:47 -0500 |
parents | 702b5c78c2de |
children | 2e7d786241d3 |
comparison
equal
deleted
inserted
replaced
339:0efa36180e8a | 340:4f5a5d5f1613 |
---|---|
183 #+caption: The node highlighted in orange is the parent node of all muscles in the worm. The arrow highlighted in yellow represents the creature's single muscle, which moves the top segment. The other nodes which are not highlighted are joints, eyes, and ears. | 183 #+caption: The node highlighted in orange is the parent node of all muscles in the worm. The arrow highlighted in yellow represents the creature's single muscle, which moves the top segment. The other nodes which are not highlighted are joints, eyes, and ears. |
184 [[../images/worm-with-muscle.png]] | 184 [[../images/worm-with-muscle.png]] |
185 | 185 |
186 #+name: test-movement | 186 #+name: test-movement |
187 #+begin_src clojure | 187 #+begin_src clojure |
188 (in-ns 'cortex.test.movement) | |
189 | |
188 (defn test-worm-movement | 190 (defn test-worm-movement |
189 "Testing movement: | 191 "Testing movement: |
190 You should see the worm suspended in mid air and a display on the | 192 You should see the worm suspended in mid air and a display on the |
191 right which shows the current relative power being exerted by the | 193 right which shows the current relative power being exerted by the |
192 muscle. As you increase muscle strength, the bar should fill with | 194 muscle. As you increase muscle strength, the bar should fill with |
215 "key-n" | 217 "key-n" |
216 (fn [_ value] | 218 (fn [_ value] |
217 (if value | 219 (if value |
218 (swap! muscle-exertion (fn [v] (- v 20)))))}) | 220 (swap! muscle-exertion (fn [v] (- v 20)))))}) |
219 (fn [world] | 221 (fn [world] |
222 | |
223 (let [timer (RatchetTimer. 60)] | |
224 (.setTimer world timer) | |
225 (display-dilated-time world timer)) | |
220 (if record? | 226 (if record? |
221 (Capture/captureVideo | 227 (Capture/captureVideo |
222 world | 228 world |
223 (File. "/home/r/proj/cortex/render/worm-muscles/main-view"))) | 229 (File. "/home/r/proj/cortex/render/worm-muscles/main-view"))) |
224 (light-up-everything world) | 230 (light-up-everything world) |
225 (enable-debug world) | 231 (enable-debug world) |
226 (.setTimer world (RatchetTimer. 60)) | |
227 (set-gravity world (Vector3f. 0 0 0)) | 232 (set-gravity world (Vector3f. 0 0 0)) |
228 (.setLocation (.getCamera world) | 233 (.setLocation (.getCamera world) |
229 (Vector3f. -4.912815, 2.004171, 0.15710819)) | 234 (Vector3f. -4.912815, 2.004171, 0.15710819)) |
230 (.setRotation (.getCamera world) | 235 (.setRotation (.getCamera world) |
231 (Quaternion. 0.13828252, 0.65516764, | 236 (Quaternion. 0.13828252, 0.65516764, |
234 (muscle-display | 239 (muscle-display |
235 (map #(% @muscle-exertion) muscles) | 240 (map #(% @muscle-exertion) muscles) |
236 (if record? | 241 (if record? |
237 (File. "/home/r/proj/cortex/render/worm-muscles/muscles")))))))) | 242 (File. "/home/r/proj/cortex/render/worm-muscles/muscles")))))))) |
238 #+end_src | 243 #+end_src |
244 | |
245 #+results: test-movement | |
246 : #'cortex.test.movement/test-worm-movement | |
239 | 247 |
240 * Video Demonstration | 248 * Video Demonstration |
241 | 249 |
242 #+begin_html | 250 #+begin_html |
243 <div class="figure"> | 251 <div class="figure"> |