public Vector4d mul(Vector4fc v, Vector4d dest) { dest.x = x * v.x(); dest.y = y * v.y(); dest.z = z * v.z(); dest.w = w * v.w(); return dest; }
public Vector4f add(Vector4fc v, Vector4f dest) { dest.x = x + v.x(); dest.y = y + v.y(); dest.z = z + v.z(); dest.w = w + v.w(); return dest; }
public Vector4f smoothStep(Vector4fc v, float t, Vector4f dest) { float t2 = t * t; float t3 = t2 * t; dest.x = (x + x - v.x() - v.x()) * t3 + (3.0f * v.x() - 3.0f * x) * t2 + x * t + x; dest.y = (y + y - v.y() - v.y()) * t3 + (3.0f * v.y() - 3.0f * y) * t2 + y * t + y; dest.z = (z + z - v.z() - v.z()) * t3 + (3.0f * v.z() - 3.0f * z) * t2 + z * t + z; dest.w = (w + w - v.w() - v.w()) * t3 + (3.0f * v.w() - 3.0f * w) * t2 + w * t + w; return dest; }
public Vector4f lerp(Vector4fc other, float t, Vector4f dest) { dest.x = x + (other.x() - x) * t; dest.y = y + (other.y() - y) * t; dest.z = z + (other.z() - z) * t; dest.w = w + (other.w() - w) * t; return dest; }
public Vector4f lerp(Vector4fc other, float t, Vector4f dest) { dest.x = x + (other.x() - x) * t; dest.y = y + (other.y() - y) * t; dest.z = z + (other.z() - z) * t; dest.w = w + (other.w() - w) * t; return dest; }
public Vector4d mul(Vector4fc v, Vector4d dest) { dest.x = x * v.x(); dest.y = y * v.y(); dest.z = z * v.z(); dest.w = w * v.w(); return dest; }
/** * Create a new {@link Vector4d} with the same values as <code>v</code>. * * @param v * the {@link Vector4fc} to copy the values from */ public Vector4d(Vector4fc v) { this(v.x(), v.y(), v.z(), v.w()); }
public Vector4f fma(float a, Vector4fc b, Vector4f dest) { dest.x = x + a * b.x(); dest.y = y + a * b.y(); dest.z = z + a * b.z(); dest.w = w + a * b.w(); return dest; }
public Vector4f mul(Vector4fc v, Vector4f dest) { dest.x = x * v.x(); dest.y = y * v.y(); dest.z = z * v.z(); dest.w = w * v.w(); return dest; }
public Vector4f hermite(Vector4fc t0, Vector4fc v1, Vector4fc t1, float t, Vector4f dest) { float t2 = t * t; float t3 = t2 * t; dest.x = (x + x - v1.x() - v1.x() + t1.x() + t0.x()) * t3 + (3.0f * v1.x() - 3.0f * x - t0.x() - t0.x() - t1.x()) * t2 + x * t + x; dest.y = (y + y - v1.y() - v1.y() + t1.y() + t0.y()) * t3 + (3.0f * v1.y() - 3.0f * y - t0.y() - t0.y() - t1.y()) * t2 + y * t + y; dest.z = (z + z - v1.z() - v1.z() + t1.z() + t0.z()) * t3 + (3.0f * v1.z() - 3.0f * z - t0.z() - t0.z() - t1.z()) * t2 + z * t + z; dest.w = (w + w - v1.w() - v1.w() + t1.w() + t0.w()) * t3 + (3.0f * v1.w() - 3.0f * w - t0.w() - t0.w() - t1.w()) * t2 + w * t + w; return dest; }
public Vector4d add(Vector4fc v, Vector4d dest) { dest.x = x + v.x(); dest.y = y + v.y(); dest.z = z + v.z(); dest.w = w + v.w(); return dest; }
public float angleCos(Vector4fc v) { double length1Squared = x * x + y * y + z * z + w * w; double length2Squared = v.x() * v.x() + v.y() * v.y() + v.z() * v.z() + v.w() * v.w(); double dot = x * v.x() + y * v.y() + z * v.z() + w * v.w(); return (float) (dot / (Math.sqrt(length1Squared * length2Squared))); }
/** * Set this {@link Vector4d} to the values of the given <code>v</code>. * * @param v * the vector whose values will be copied into this * @return this */ public Vector4d set(Vector4fc v) { return set(v.x(), v.y(), v.z(), v.w()); }
/** * Set this {@link Vector4d} to the values of the given <code>v</code>. * * @param v * the vector whose values will be copied into this * @return this */ public Vector4d set(Vector4fc v) { return set(v.x(), v.y(), v.z(), v.w()); }
public Matrix4x3f shadow(Vector4fc light, Matrix4x3fc planeTransform, Matrix4x3f dest) { // compute plane equation by transforming (y = 0) float a = planeTransform.m10(); float b = planeTransform.m11(); float c = planeTransform.m12(); float d = -a * planeTransform.m30() - b * planeTransform.m31() - c * planeTransform.m32(); return shadow(light.x(), light.y(), light.z(), light.w(), a, b, c, d, dest); }
public Matrix4x3f shadow(Vector4fc light, Matrix4x3fc planeTransform, Matrix4x3f dest) { // compute plane equation by transforming (y = 0) float a = planeTransform.m10(); float b = planeTransform.m11(); float c = planeTransform.m12(); float d = -a * planeTransform.m30() - b * planeTransform.m31() - c * planeTransform.m32(); return shadow(light.x(), light.y(), light.z(), light.w(), a, b, c, d, dest); }