예제 #1
0
 public static Quaternion cosh(Quaternion q) {
   Double3Vector imag = q.imag();
   final double imagNorm = imag.norm();
   return new Quaternion(
       ExtraMath.cosh(q.re) * Math.cos(imagNorm),
       (Double3Vector) imag.normalize().scalarMultiply(ExtraMath.sinh(q.re) * Math.sin(imagNorm)));
 }
예제 #2
0
 public static Quaternion exp(Quaternion q) {
   final double k = Math.exp(q.re);
   Double3Vector imag = q.imag();
   final double imagNorm = imag.norm();
   return new Quaternion(
       k * Math.cos(imagNorm),
       (Double3Vector) imag.normalize().scalarMultiply(k * Math.sin(imagNorm)));
 }
예제 #3
0
 /**
  * Returns the subtraction of this quaternion by an imaginary part.
  *
  * @param imag an imaginary part
  */
 public Quaternion subtractImag(final Double3Vector imag) {
   return new Quaternion(
       re, imi - imag.getComponent(0), imj - imag.getComponent(1), imk - imag.getComponent(2));
 }
예제 #4
0
 /** Constructs a quaternion. */
 public Quaternion(final double real, final Double3Vector imag) {
   re = real;
   imi = imag.getComponent(0);
   imj = imag.getComponent(1);
   imk = imag.getComponent(2);
 }
예제 #5
0
 /**
  * Returns the addition of this quaternion with an imaginary part.
  *
  * @param imag an imaginary part
  */
 public Quaternion addImag(final Double3Vector imag) {
   return new Quaternion(
       re, imi + imag.getComponent(0), imj + imag.getComponent(1), imk + imag.getComponent(2));
 }