summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-11-27 16:37:06 +0100
committerPeter Wu <lekensteyn@gmail.com>2013-11-27 17:06:16 +0100
commit7e101b0c9bf4d519b6bf9dcdc6b0ca3e09124b93 (patch)
treefbc79d9af53ac24b19104bd25b426ceeaa91aca4
parent570e7934455bee0632794e59d4284d839a259cdd (diff)
download2iv60-robots-7e101b0c9bf4d519b6bf9dcdc6b0ca3e09124b93.tar.gz
Forgot to make eye point relative to center point
Also fix comment (missing phi/theta description, typo in Eye_z).
-rw-r--r--src/RobotRace.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/RobotRace.java b/src/RobotRace.java
index 8e26f1f..42850d1 100644
--- a/src/RobotRace.java
+++ b/src/RobotRace.java
@@ -737,12 +737,14 @@ public class RobotRace extends Base {
private void setDefaultMode() {
/* z |
* | vDist %
- * | % * Ey
+ * | % * Ez
* |%________*________ y
* Ex / % *
* / s % *
* x / - - - - - - - *
* Ey
+ * phi is angle between vDist and XY plane (Z direction)
+ * theta is angle between X-axis and s (XY plane)
* E = (Ex, Ey, Ez)
* sin phi = Ez / vDist => Ez = vDist * sin phi
* cos phi = s / vDist => s = vDist * cos phi
@@ -755,6 +757,11 @@ public class RobotRace extends Base {
Ex = s * (float) sin(gs.theta);
Ey = s * (float) cos(gs.theta);
+ // change center point with WASD
+ Ex += gs.cnt.x();
+ Ey += gs.cnt.y();
+ Ez += gs.cnt.z();
+
eye = new Vector(Ex, Ey, Ez);
}