Пример #1
0
 /**
  * @param o the object to compare for equality
  * @return true if this quaternion and the provided quaternion have roughly the same x, y, z and w
  *     values.
  */
 @Override
 public boolean equals(final Object o) {
   if (this == o) {
     return true;
   }
   if (!(o instanceof Quaternion)) {
     return false;
   }
   final Quaternion comp = (Quaternion) o;
   return Math.abs(x - comp.getX()) <= ALLOWED_DEVIANCE
       && Math.abs(y - comp.getY()) <= ALLOWED_DEVIANCE
       && Math.abs(z - comp.getZ()) <= ALLOWED_DEVIANCE
       && Math.abs(w - comp.getW()) <= ALLOWED_DEVIANCE;
 }
Пример #2
0
 /** Returns the dot product of this quaternion with the given quaternion */
 public final float dot(final Quaternion quat) {
   return dot(quat.getX(), quat.getY(), quat.getZ(), quat.getW());
 }