Mercurial > cortex
changeset 154:bb235258f835
deleted code from purgatory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 03 Feb 2012 06:01:22 -0700 |
parents | c95179907951 |
children | 95bf55614211 |
files | org/test-creature.org |
diffstat | 1 files changed, 0 insertions(+), 175 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/org/test-creature.org Fri Feb 03 05:59:32 2012 -0700 1.2 +++ b/org/test-creature.org Fri Feb 03 06:01:22 2012 -0700 1.3 @@ -1038,34 +1038,6 @@ 1.4 1.5 * COMMENT purgatory 1.6 #+begin_src clojure 1.7 -(defn bullet-trans [] 1.8 - (let [obj-a (sphere 0.5 :color ColorRGBA/Red 1.9 - :position (Vector3f. -10 5 0)) 1.10 - obj-b (sphere 0.5 :color ColorRGBA/Blue 1.11 - :position (Vector3f. -10 -5 0) 1.12 - :mass 0) 1.13 - control-a (.getControl obj-a RigidBodyControl) 1.14 - control-b (.getControl obj-b RigidBodyControl) 1.15 - swivel 1.16 - (.toRotationMatrix 1.17 - (doto (Quaternion.) 1.18 - (.fromAngleAxis (/ Math/PI 2) 1.19 - Vector3f/UNIT_X)))] 1.20 - (doto 1.21 - (ConeJoint. 1.22 - control-a control-b 1.23 - (Vector3f. 0 5 0) 1.24 - (Vector3f. 0 -5 0) 1.25 - swivel swivel) 1.26 - (.setLimit (* 0.6 (/ Math/PI 4)) 1.27 - (/ Math/PI 4) 1.28 - (* Math/PI 0.8))) 1.29 - (world (nodify 1.30 - [obj-a obj-b]) 1.31 - standard-debug-controls 1.32 - enable-debug 1.33 - no-op))) 1.34 - 1.35 1.36 (defn bullet-trans* [] 1.37 (let [obj-a (box 1.5 0.5 0.5 :color ColorRGBA/Red 1.38 @@ -1159,124 +1131,6 @@ 1.39 ) 1.40 )) 1.41 1.42 -(defn transform-trianglesdsd 1.43 - "Transform that converts each vertex in the first triangle 1.44 - into the corresponding vertex in the second triangle." 1.45 - [#^Triangle tri-1 #^Triangle tri-2] 1.46 - (let [in [(.get1 tri-1) 1.47 - (.get2 tri-1) 1.48 - (.get3 tri-1)] 1.49 - out [(.get1 tri-2) 1.50 - (.get2 tri-2) 1.51 - (.get3 tri-2)]] 1.52 - (let [translate (doto (Matrix4f.) (.setTranslation (.negate (in 0)))) 1.53 - in* [(.mult translate (in 0)) 1.54 - (.mult translate (in 1)) 1.55 - (.mult translate (in 2))] 1.56 - final-translation 1.57 - (doto (Matrix4f.) 1.58 - (.setTranslation (out 1))) 1.59 - 1.60 - rotate-1 1.61 - (doto (Matrix3f.) 1.62 - (.fromStartEndVectors 1.63 - (.normalize 1.64 - (.subtract 1.65 - (in* 1) (in* 0))) 1.66 - (.normalize 1.67 - (.subtract 1.68 - (out 1) (out 0))))) 1.69 - in** [(.mult rotate-1 (in* 0)) 1.70 - (.mult rotate-1 (in* 1)) 1.71 - (.mult rotate-1 (in* 2))] 1.72 - scale-factor-1 1.73 - (.mult 1.74 - (.normalize 1.75 - (.subtract 1.76 - (out 1) 1.77 - (out 0))) 1.78 - (/ (.length 1.79 - (.subtract (out 1) 1.80 - (out 0))) 1.81 - (.length 1.82 - (.subtract (in** 1) 1.83 - (in** 0))))) 1.84 - scale-1 (doto (Matrix4f.) (.setScale scale-factor-1)) 1.85 - in*** [(.mult scale-1 (in** 0)) 1.86 - (.mult scale-1 (in** 1)) 1.87 - (.mult scale-1 (in** 2))] 1.88 - 1.89 - 1.90 - 1.91 - 1.92 - 1.93 - ] 1.94 - 1.95 - (dorun (map println in)) 1.96 - (println) 1.97 - (dorun (map println in*)) 1.98 - (println) 1.99 - (dorun (map println in**)) 1.100 - (println) 1.101 - (dorun (map println in***)) 1.102 - (println) 1.103 - 1.104 - )))) 1.105 - 1.106 - 1.107 -(defn world-setup [joint] 1.108 - (let [joint-position (Vector3f. 0 0 0) 1.109 - joint-rotation 1.110 - (.toRotationMatrix 1.111 - (.mult 1.112 - (doto (Quaternion.) 1.113 - (.fromAngleAxis 1.114 - (* 1 (/ Math/PI 4)) 1.115 - (Vector3f. -1 0 0))) 1.116 - (doto (Quaternion.) 1.117 - (.fromAngleAxis 1.118 - (* 1 (/ Math/PI 2)) 1.119 - (Vector3f. 0 0 1))))) 1.120 - top-position (.mult joint-rotation (Vector3f. 8 0 0)) 1.121 - 1.122 - origin (doto 1.123 - (sphere 0.1 :physical? false :color ColorRGBA/Cyan 1.124 - :position top-position)) 1.125 - top (doto 1.126 - (sphere 0.1 :physical? false :color ColorRGBA/Yellow 1.127 - :position top-position) 1.128 - 1.129 - (.addControl 1.130 - (RigidBodyControl. 1.131 - (CapsuleCollisionShape. 0.5 1.5 1) (float 20)))) 1.132 - bottom (doto 1.133 - (sphere 0.1 :physical? false :color ColorRGBA/DarkGray 1.134 - :position (Vector3f. 0 0 0)) 1.135 - (.addControl 1.136 - (RigidBodyControl. 1.137 - (CapsuleCollisionShape. 0.5 1.5 1) (float 0)))) 1.138 - table (box 10 2 10 :position (Vector3f. 0 -20 0) 1.139 - :color ColorRGBA/Gray :mass 0) 1.140 - a (.getControl top RigidBodyControl) 1.141 - b (.getControl bottom RigidBodyControl)] 1.142 - 1.143 - (cond 1.144 - (= joint :cone) 1.145 - 1.146 - (doto (ConeJoint. 1.147 - a b 1.148 - (world-to-local top joint-position) 1.149 - (world-to-local bottom joint-position) 1.150 - joint-rotation 1.151 - joint-rotation 1.152 - ) 1.153 - 1.154 - 1.155 - (.setLimit (* (/ 10) Math/PI) 1.156 - (* (/ 4) Math/PI) 1.157 - 0))) 1.158 - [origin top bottom table])) 1.159 - 1.160 (defn test-joint [joint] 1.161 (let [[origin top bottom floor] (world-setup joint) 1.162 control (.getControl top RigidBodyControl) 1.163 @@ -1341,35 +1195,6 @@ 1.164 (.applyTorque control 1.165 (.mult (.getPhysicsRotation control) 1.166 (Vector3f. 1 0 0)))))))) 1.167 - 1.168 - 1.169 - 1.170 -(defprotocol Frame 1.171 - (frame [this])) 1.172 - 1.173 -(extend-type BufferedImage 1.174 - Frame 1.175 - (frame [image] 1.176 - (merge 1.177 - (apply 1.178 - hash-map 1.179 - (interleave 1.180 - (doall (for [x (range (.getWidth image)) y (range (.getHeight image))] 1.181 - (vector x y))) 1.182 - (doall (for [x (range (.getWidth image)) y (range (.getHeight image))] 1.183 - (let [data (.getRGB image x y)] 1.184 - (hash-map :r (bit-shift-right (bit-and 0xff0000 data) 16) 1.185 - :g (bit-shift-right (bit-and 0x00ff00 data) 8) 1.186 - :b (bit-and 0x0000ff data))))))) 1.187 - {:width (.getWidth image) :height (.getHeight image)}))) 1.188 - 1.189 - 1.190 -(extend-type ImagePlus 1.191 - Frame 1.192 - (frame [image+] 1.193 - (frame (.getBufferedImage image+)))) 1.194 - 1.195 - 1.196 #+end_src 1.197 1.198