/** * @param x * @param y * @param z * @param w * @return the dot product of this quaternion with the given x,y,z and w values. */ @Override public double dot(final double x, final double y, final double z, final double w) { return getX() * x + getY() * y + getZ() * z + getW() * w; }
/** * @return the string representation of this quaternion. */ @Override public String toString() { return "com.ardor3d.math.Quaternion [X=" + getX() + ", Y=" + getY() + ", Z=" + getZ() + ", W=" + getW() + "]"; }
/** * @param x * @param y * @param z * @param w * @return the dot product of this quaternion with the given x,y,z and w values. */ @Override public double dot(final double x, final double y, final double z, final double w) { return getX() * x + getY() * y + getZ() * z + getW() * w; }
/** * @return the string representation of this quaternion. */ @Override public String toString() { return "com.ardor3d.math.Quaternion [X=" + getX() + ", Y=" + getY() + ", Z=" + getZ() + ", W=" + getW() + "]"; }
/** * Internally sets this quaternion to its conjugate <code>[-x, -y, -z, w]</code>. * * @return this <code>Quaternion</code> for chaining. */ public Quaternion conjugateLocal() { return set(-getX(), -getY(), -getZ(), getW()); }
/** * Internally sets this quaternion to its conjugate <code>[-x, -y, -z, w]</code>. * * @return this <code>Quaternion</code> for chaining. */ public Quaternion conjugateLocal() { return set(-getX(), -getY(), -getZ(), getW()); }
/** * @return this quaternion, modified to be unit length, for chaining. */ public Quaternion normalizeLocal() { final double n = 1.0 / magnitude(); final double x = getX() * n; final double y = getY() * n; final double z = getZ() * n; final double w = getW() * n; return set(x, y, z, w); }
/** * @return this quaternion, modified to be unit length, for chaining. */ public Quaternion normalizeLocal() { final double n = 1.0 / magnitude(); final double x = getX() * n; final double y = getY() * n; final double z = getZ() * n; final double w = getW() * n; return set(x, y, z, w); }
/** * Creates a new quaternion that is the conjugate <code>[-x, -y, -z, w]</code> of this quaternion. * * @param store * the <code>Quaternion</code> to store the result in. If <code>null</code>, a new one is created. * @return the conjugate to this quaternion. */ @Override public Quaternion conjugate(Quaternion store) { if (store == null) { store = new Quaternion(); } return store.set(-getX(), -getY(), -getZ(), getW()); }
@Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(getX(), "x", 0); capsule.write(getY(), "y", 0); capsule.write(getZ(), "z", 0); capsule.write(getW(), "w", 1); }
@Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(getX(), "x", 0); capsule.write(getY(), "y", 0); capsule.write(getZ(), "z", 0); capsule.write(getW(), "w", 1); }
/** * Used with serialization. Not to be called manually. * * @param out * ObjectOutput * @throws IOException */ @Override public void writeExternal(final ObjectOutput out) throws IOException { out.writeDouble(getX()); out.writeDouble(getY()); out.writeDouble(getZ()); out.writeDouble(getW()); }
/** * Multiplies each value of this quaternion by the given scalar value. The result is stored in this quaternion. * * @param scalar * the quaternion to multiply this quaternion by. * @return this quaternion for chaining. */ public Quaternion multiplyLocal(final double scalar) { setX(getX() * scalar); setY(getY() * scalar); setZ(getZ() * scalar); setW(getW() * scalar); return this; }
/** * @param quat * @param store * the Quaternion to store the result in. if null, a new one is created. * @return a quaternion representing the fields of this quaternion subtracted from those of the given quaternion. */ @Override public Quaternion subtract(final ReadOnlyQuaternion quat, final Quaternion store) { Quaternion result = store; if (result == null) { result = new Quaternion(); } return result.set(getX() - quat.getX(), getY() - quat.getY(), getZ() - quat.getZ(), getW() - quat.getW()); }
/** * Internally decrements the fields of this quaternion by the field values of the given quaternion. * * @param quat * @return this quaternion for chaining. */ public Quaternion subtractLocal(final ReadOnlyQuaternion quat) { setX(getX() - quat.getX()); setY(getY() - quat.getY()); setZ(getZ() - quat.getZ()); setW(getW() - quat.getW()); return this; }
/** * Internally increments the fields of this quaternion with the field values of the given quaternion. * * @param quat * @return this quaternion for chaining */ public Quaternion addLocal(final ReadOnlyQuaternion quat) { setX(getX() + quat.getX()); setY(getY() + quat.getY()); setZ(getZ() + quat.getZ()); setW(getW() + quat.getW()); return this; }
/** * Internally increments the fields of this quaternion with the field values of the given quaternion. * * @param quat * @return this quaternion for chaining */ public Quaternion addLocal(final ReadOnlyQuaternion quat) { setX(getX() + quat.getX()); setY(getY() + quat.getY()); setZ(getZ() + quat.getZ()); setW(getW() + quat.getW()); return this; }
/** * Internally decrements the fields of this quaternion by the field values of the given quaternion. * * @param quat * @return this quaternion for chaining. */ public Quaternion subtractLocal(final ReadOnlyQuaternion quat) { setX(getX() - quat.getX()); setY(getY() - quat.getY()); setZ(getZ() - quat.getZ()); setW(getW() - quat.getW()); return this; }