RLPark 1.0.0
Reinforcement Learning Framework in Java

Quaternion.java

Go to the documentation of this file.
00001 package rlpark.plugin.rltoys.problems.helicopter;
00002 
00003 public class Quaternion {
00004   public double x;
00005   public double y;
00006   public double z;
00007   public double w;
00008 
00009   public Quaternion(Quaternion qToCopy) {
00010     this.x = qToCopy.x;
00011     this.y = qToCopy.y;
00012     this.z = qToCopy.z;
00013     this.w = qToCopy.w;
00014   }
00015 
00016   public Quaternion(double x, double y, double z, double w) {
00017     this.x = x;
00018     this.y = y;
00019     this.z = z;
00020     this.w = w;
00021   }
00022 
00023   public Quaternion(HeliVector v) {
00024     this.x = v.x;
00025     this.y = v.y;
00026     this.z = v.z;
00027     this.w = 0.0;
00028   }
00029 
00030   public Quaternion conj() {
00031     return new Quaternion(-x, -y, -z, w);
00032   }
00033 
00034   public HeliVector complex_part() {
00035     return new HeliVector(this.x, this.y, this.z);
00036   }
00037 
00038   public Quaternion mult(Quaternion rq) {
00039     return new Quaternion(this.w * rq.x + this.x * rq.w + this.y * rq.z - this.z * rq.y, this.w * rq.y - this.x * rq.z
00040         + this.y * rq.w + this.z * rq.x, this.w * rq.z + this.x * rq.y - this.y * rq.x + this.z * rq.w, this.w * rq.w
00041         - this.x * rq.x - this.y * rq.y - this.z * rq.z);
00042   }
00043 
00044   void stringSerialize(StringBuffer b) {
00045     b.append("x_" + x);
00046     b.append("y_" + y);
00047     b.append("z_" + z);
00048     b.append("w_" + w);
00049   }
00050 
00051   public void reset() {
00052     x = 0.0;
00053     y = 0.0;
00054     z = 0.0;
00055     w = 1.0;
00056   }
00057 }
 All Classes Namespaces Files Functions Variables Enumerations
Zephyr
RLPark