/** * Create a new {@link Quaterniond} and initialize its components to the same values as the given {@link Quaternionfc}. * * @param source * the {@link Quaternionfc} to take the component values from */ public Quaterniond(Quaternionfc source) { x = source.x(); y = source.y(); z = source.z(); w = source.w(); }
public Matrix4f reflect(Quaternionfc orientation, Vector3fc point, Matrix4f dest) { double num1 = orientation.x() + orientation.x(); double num2 = orientation.y() + orientation.y(); double num3 = orientation.z() + orientation.z(); float normalX = (float) (orientation.x() * num3 + orientation.w() * num2); float normalY = (float) (orientation.y() * num3 - orientation.w() * num1); float normalZ = (float) (1.0 - (orientation.x() * num1 + orientation.y() * num2)); return reflect(normalX, normalY, normalZ, point.x(), point.y(), point.z(), dest); }
public Quaternionf add(Quaternionfc q2, Quaternionf dest) { dest.x = x + q2.x(); dest.y = y + q2.y(); dest.z = z + q2.z(); dest.w = w + q2.w(); return dest; }
public Quaternionf add(Quaternionfc q2, Quaternionf dest) { dest.x = x + q2.x(); dest.y = y + q2.y(); dest.z = z + q2.z(); dest.w = w + q2.w(); return dest; }
public Matrix4x3f reflect(Quaternionfc orientation, Vector3fc point, Matrix4x3f dest) { double num1 = orientation.x() + orientation.x(); double num2 = orientation.y() + orientation.y(); double num3 = orientation.z() + orientation.z(); float normalX = (float) (orientation.x() * num3 + orientation.w() * num2); float normalY = (float) (orientation.y() * num3 - orientation.w() * num1); float normalZ = (float) (1.0 - (orientation.x() * num1 + orientation.y() * num2)); return reflect(normalX, normalY, normalZ, point.x(), point.y(), point.z(), dest); }
public Matrix4x3f reflect(Quaternionfc orientation, Vector3fc point, Matrix4x3f dest) { double num1 = orientation.x() + orientation.x(); double num2 = orientation.y() + orientation.y(); double num3 = orientation.z() + orientation.z(); float normalX = (float) (orientation.x() * num3 + orientation.w() * num2); float normalY = (float) (orientation.y() * num3 - orientation.w() * num1); float normalZ = (float) (1.0 - (orientation.x() * num1 + orientation.y() * num2)); return reflect(normalX, normalY, normalZ, point.x(), point.y(), point.z(), dest); }
/** * Create a new {@link Quaterniond} and initialize its components to the same values as the given {@link Quaternionfc}. * * @param source * the {@link Quaternionfc} to take the component values from */ public Quaterniond(Quaternionfc source) { x = source.x(); y = source.y(); z = source.z(); w = source.w(); }
public Matrix4f reflect(Quaternionfc orientation, Vector3fc point, Matrix4f dest) { double num1 = orientation.x() + orientation.x(); double num2 = orientation.y() + orientation.y(); double num3 = orientation.z() + orientation.z(); float normalX = (float) (orientation.x() * num3 + orientation.w() * num2); float normalY = (float) (orientation.y() * num3 - orientation.w() * num1); float normalZ = (float) (1.0 - (orientation.x() * num1 + orientation.y() * num2)); return reflect(normalX, normalY, normalZ, point.x(), point.y(), point.z(), dest); }
/** * Set this quaternion to be a copy of q. * * @param q * the {@link Quaternionfc} to copy * @return this */ public Quaterniond set(Quaternionfc q) { x = q.x(); y = q.y(); z = q.z(); w = q.w(); return this; }
/** * Add <code>q2</code> to this quaternion. * * @param q2 * the quaternion to add to this * @return this */ public Quaternionf add(Quaternionfc q2) { x += q2.x(); y += q2.y(); z += q2.z(); w += q2.w(); return this; }
public Quaternionf div(Quaternionfc b, Quaternionf dest) { float invNorm = 1.0f / (b.x() * b.x() + b.y() * b.y() + b.z() * b.z() + b.w() * b.w()); float x = -b.x() * invNorm; float y = -b.y() * invNorm; float z = -b.z() * invNorm; float w = b.w() * invNorm; dest.set(this.w * x + this.x * w + this.y * z - this.z * y, this.w * y - this.x * z + this.y * w + this.z * x, this.w * z + this.x * y - this.y * x + this.z * w, this.w * w - this.x * x - this.y * y - this.z * z); return dest; }
/** * Add <code>q2</code> to this quaternion. * * @param q2 * the quaternion to add to this * @return this */ public Quaternionf add(Quaternionfc q2) { x += q2.x(); y += q2.y(); z += q2.z(); w += q2.w(); return this; }
public Quaternionf div(Quaternionfc b, Quaternionf dest) { float invNorm = 1.0f / (b.x() * b.x() + b.y() * b.y() + b.z() * b.z() + b.w() * b.w()); float x = -b.x() * invNorm; float y = -b.y() * invNorm; float z = -b.z() * invNorm; float w = b.w() * invNorm; dest.set(this.w * x + this.x * w + this.y * z - this.z * y, this.w * y - this.x * z + this.y * w + this.z * x, this.w * z + this.x * y - this.y * x + this.z * w, this.w * w - this.x * x - this.y * y - this.z * z); return dest; }
/** * Set this quaternion to be a copy of q. * * @param q * the {@link Quaternionfc} to copy * @return this */ public Quaterniond set(Quaternionfc q) { x = q.x(); y = q.y(); z = q.z(); w = q.w(); return this; }
public Quaternionf nlerp(Quaternionfc q, float factor, Quaternionf dest) { float cosom = x * q.x() + y * q.y() + z * q.z() + w * q.w(); float scale0 = 1.0f - factor; float scale1 = (cosom >= 0.0f) ? factor : -factor; dest.x = scale0 * x + scale1 * q.x(); dest.y = scale0 * y + scale1 * q.y(); dest.z = scale0 * z + scale1 * q.z(); dest.w = scale0 * w + scale1 * q.w(); float s = (float) (1.0 / Math.sqrt(dest.x * dest.x + dest.y * dest.y + dest.z * dest.z + dest.w * dest.w)); dest.x *= s; dest.y *= s; dest.z *= s; dest.w *= s; return dest; }
public Quaternionf nlerp(Quaternionfc q, float factor, Quaternionf dest) { float cosom = x * q.x() + y * q.y() + z * q.z() + w * q.w(); float scale0 = 1.0f - factor; float scale1 = (cosom >= 0.0f) ? factor : -factor; dest.x = scale0 * x + scale1 * q.x(); dest.y = scale0 * y + scale1 * q.y(); dest.z = scale0 * z + scale1 * q.z(); dest.w = scale0 * w + scale1 * q.w(); float s = (float) (1.0 / Math.sqrt(dest.x * dest.x + dest.y * dest.y + dest.z * dest.z + dest.w * dest.w)); dest.x *= s; dest.y *= s; dest.z *= s; dest.w *= s; return dest; }