public Vector4d fma(double a, Vector4dc b, Vector4d 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 Vector4d mul(Vector4dc 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 Vector4d add(Vector4dc 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 Vector4d smoothStep(Vector4dc v, double t, Vector4d dest) { double t2 = t * t; double t3 = t2 * t; dest.x = (x + x - v.x() - v.x()) * t3 + (3.0 * v.x() - 3.0 * x) * t2 + x * t + x; dest.y = (y + y - v.y() - v.y()) * t3 + (3.0 * v.y() - 3.0 * y) * t2 + y * t + y; dest.z = (z + z - v.z() - v.z()) * t3 + (3.0 * v.z() - 3.0 * z) * t2 + z * t + z; dest.w = (w + w - v.w() - v.w()) * t3 + (3.0 * v.w() - 3.0 * w) * t2 + w * t + w; return dest; }
public Vector4d hermite(Vector4dc t0, Vector4dc v1, Vector4dc t1, double t, Vector4d dest) { double t2 = t * t; double t3 = t2 * t; dest.x = (x + x - v1.x() - v1.x() + t1.x() + t0.x()) * t3 + (3.0 * v1.x() - 3.0 * 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.0 * v1.y() - 3.0 * 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.0 * v1.z() - 3.0 * 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.0 * v1.w() - 3.0 * w - t0.w() - t0.w() - t1.w()) * t2 + w * t + w; return dest; }
/** * Create a new {@link Vector4d} with the same values as <code>v</code>. * * @param v * the {@link Vector4dc} to copy the values from */ public Vector4d(Vector4dc v) { this(v.x(), v.y(), v.z(), v.w()); }
public Vector4d div(Vector4dc 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 Vector4d lerp(Vector4dc other, double t, Vector4d 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 add(Vector4dc 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 Vector4d div(Vector4dc 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 Vector4d hermite(Vector4dc t0, Vector4dc v1, Vector4dc t1, double t, Vector4d dest) { double t2 = t * t; double t3 = t2 * t; dest.x = (x + x - v1.x() - v1.x() + t1.x() + t0.x()) * t3 + (3.0 * v1.x() - 3.0 * 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.0 * v1.y() - 3.0 * 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.0 * v1.z() - 3.0 * 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.0 * v1.w() - 3.0 * w - t0.w() - t0.w() - t1.w()) * t2 + w * t + w; return dest; }
public double angleCos(Vector4dc 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 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(Vector4dc v) { return set(v.x(), v.y(), v.z(), v.w()); }
public Matrix4d shadow(Vector4dc light, Matrix4dc planeTransform, Matrix4d dest) { // compute plane equation by transforming (y = 0) double a = planeTransform.m10(); double b = planeTransform.m11(); double c = planeTransform.m12(); double 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 Matrix4x3d shadow(Vector4dc light, Matrix4x3dc planeTransform, Matrix4x3d dest) { // compute plane equation by transforming (y = 0) double a = planeTransform.m10(); double b = planeTransform.m11(); double c = planeTransform.m12(); double 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 Matrix4x3d shadow(Vector4dc light, Matrix4x3dc planeTransform, Matrix4x3d dest) { // compute plane equation by transforming (y = 0) double a = planeTransform.m10(); double b = planeTransform.m11(); double c = planeTransform.m12(); double 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); }