Пример #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
 public static Quaternion log(Quaternion q) {
   final double norm = q.norm();
   return new Quaternion(
       Math.log(norm),
       (Double3Vector) q.imag().normalize().scalarMultiply(Math.acos(q.re / norm)));
 }