/** Spherical linearly interpolates multiple quaternions by the given weights and stores the result in this Quaternion. Will not * destroy the data previously inside the elements of q or w. result = (q_1^w_1)*(q_2^w_2)* ... *(q_n^w_n) where the sum of w_i * is 1. Lists must be equal in length. * @param q List of quaternions * @param w List of weights * @return This quaternion for chaining */ public Quaternion slerp (Quaternion[] q, float[] w) { // Calculate exponents and multiply everything from left to right set(q[0]).exp(w[0]); for (int i = 1; i < q.length; i++) mul(tmp1.set(q[i]).exp(w[i])); nor(); return this; }
/** Spherical linearly interpolates multiple quaternions and stores the result in this Quaternion. Will not destroy the data * previously inside the elements of q. result = (q_1^w_1)*(q_2^w_2)* ... *(q_n^w_n) where w_i=1/n. * @param q List of quaternions * @return This quaternion for chaining */ public Quaternion slerp (Quaternion[] q) { // Calculate exponents and multiply everything from left to right final float w = 1.0f / q.length; set(q[0]).exp(w); for (int i = 1; i < q.length; i++) mul(tmp1.set(q[i]).exp(w)); nor(); return this; }
/** Spherical linearly interpolates multiple quaternions and stores the result in this Quaternion. Will not destroy the data * previously inside the elements of q. result = (q_1^w_1)*(q_2^w_2)* ... *(q_n^w_n) where w_i=1/n. * @param q List of quaternions * @return This quaternion for chaining */ public Quaternion slerp (Quaternion[] q) { // Calculate exponents and multiply everything from left to right final float w = 1.0f / q.length; set(q[0]).exp(w); for (int i = 1; i < q.length; i++) mul(tmp1.set(q[i]).exp(w)); nor(); return this; }
/** Spherical linearly interpolates multiple quaternions by the given weights and stores the result in this Quaternion. Will not * destroy the data previously inside the elements of q or w. result = (q_1^w_1)*(q_2^w_2)* ... *(q_n^w_n) where the sum of w_i * is 1. Lists must be equal in length. * @param q List of quaternions * @param w List of weights * @return This quaternion for chaining */ public Quaternion slerp (Quaternion[] q, float[] w) { // Calculate exponents and multiply everything from left to right set(q[0]).exp(w[0]); for (int i = 1; i < q.length; i++) mul(tmp1.set(q[i]).exp(w[i])); nor(); return this; }
/** Averages the given transforms and stores the result in this matrix. Translations and scales are lerped while rotations are * slerped. Does not destroy the data contained in t. * @param t List of transforms * @return This matrix for chaining */ public Matrix4 avg (Matrix4[] t) { final float w = 1.0f / t.length; tmpVec.set(t[0].getScale(tmpUp).scl(w)); quat.set(t[0].getRotation(quat2).exp(w)); tmpForward.set(t[0].getTranslation(tmpUp).scl(w)); for (int i = 1; i < t.length; i++) { tmpVec.add(t[i].getScale(tmpUp).scl(w)); quat.mul(t[i].getRotation(quat2).exp(w)); tmpForward.add(t[i].getTranslation(tmpUp).scl(w)); } quat.nor(); setToScaling(tmpVec); rotate(quat); setTranslation(tmpForward); return this; }
/** Averages the given transforms and stores the result in this matrix. Translations and scales are lerped while rotations are * slerped. Does not destroy the data contained in t. * @param t List of transforms * @return This matrix for chaining */ public Matrix4 avg (Matrix4[] t) { final float w = 1.0f / t.length; tmpVec.set(t[0].getScale(tmpUp).scl(w)); quat.set(t[0].getRotation(quat2).exp(w)); tmpForward.set(t[0].getTranslation(tmpUp).scl(w)); for (int i = 1; i < t.length; i++) { tmpVec.add(t[i].getScale(tmpUp).scl(w)); quat.mul(t[i].getRotation(quat2).exp(w)); tmpForward.add(t[i].getTranslation(tmpUp).scl(w)); } quat.nor(); setToScaling(tmpVec); rotate(quat); setTranslation(tmpForward); return this; }
/** Averages the given transforms with the given weights and stores the result in this matrix. Translations and scales are * lerped while rotations are slerped. Does not destroy the data contained in t or w; Sum of w_i must be equal to 1, or * unexpected results will occur. * @param t List of transforms * @param w List of weights * @return This matrix for chaining */ public Matrix4 avg (Matrix4[] t, float[] w) { tmpVec.set(t[0].getScale(tmpUp).scl(w[0])); quat.set(t[0].getRotation(quat2).exp(w[0])); tmpForward.set(t[0].getTranslation(tmpUp).scl(w[0])); for (int i = 1; i < t.length; i++) { tmpVec.add(t[i].getScale(tmpUp).scl(w[i])); quat.mul(t[i].getRotation(quat2).exp(w[i])); tmpForward.add(t[i].getTranslation(tmpUp).scl(w[i])); } quat.nor(); setToScaling(tmpVec); rotate(quat); setTranslation(tmpForward); return this; }
/** Averages the given transforms with the given weights and stores the result in this matrix. Translations and scales are * lerped while rotations are slerped. Does not destroy the data contained in t or w; Sum of w_i must be equal to 1, or * unexpected results will occur. * @param t List of transforms * @param w List of weights * @return This matrix for chaining */ public Matrix4 avg (Matrix4[] t, float[] w) { tmpVec.set(t[0].getScale(tmpUp).scl(w[0])); quat.set(t[0].getRotation(quat2).exp(w[0])); tmpForward.set(t[0].getTranslation(tmpUp).scl(w[0])); for (int i = 1; i < t.length; i++) { tmpVec.add(t[i].getScale(tmpUp).scl(w[i])); quat.mul(t[i].getRotation(quat2).exp(w[i])); tmpForward.add(t[i].getTranslation(tmpUp).scl(w[i])); } quat.nor(); setToScaling(tmpVec); rotate(quat); setTranslation(tmpForward); return this; }
/** Spherical linearly interpolates multiple quaternions and stores the result in this Quaternion. Will not destroy the data * previously inside the elements of q. result = (q_1^w_1)*(q_2^w_2)* ... *(q_n^w_n) where w_i=1/n. * @param q List of quaternions * @return This quaternion for chaining */ public Quaternion slerp (Quaternion[] q) { // Calculate exponents and multiply everything from left to right final float w = 1.0f / q.length; set(q[0]).exp(w); for (int i = 1; i < q.length; i++) mul(tmp1.set(q[i]).exp(w)); nor(); return this; }
/** Spherical linearly interpolates multiple quaternions by the given weights and stores the result in this Quaternion. Will not * destroy the data previously inside the elements of q or w. result = (q_1^w_1)*(q_2^w_2)* ... *(q_n^w_n) where the sum of w_i * is 1. Lists must be equal in length. * @param q List of quaternions * @param w List of weights * @return This quaternion for chaining */ public Quaternion slerp (Quaternion[] q, float[] w) { // Calculate exponents and multiply everything from left to right set(q[0]).exp(w[0]); for (int i = 1; i < q.length; i++) mul(tmp1.set(q[i]).exp(w[i])); nor(); return this; }
/** * Spherical linearly interpolates multiple quaternions and stores the result in this Quaternion. * Will not destroy the data previously inside the elements of q. * result = (q_1^w_1)*(q_2^w_2)* ... *(q_n^w_n) where w_i=1/n. * @param q List of quaternions * @return This quaternion for chaining */ public Quaternion slerp (Quaternion[] q) { //Calculate exponents and multiply everything from left to right final float w = 1.0f/q.length; set(q[0]).exp(w); for(int i=1;i<q.length;i++) mul(tmp1.set(q[i]).exp(w)); nor(); return this; }
/** * Spherical linearly interpolates multiple quaternions by the given weights and stores the result in this Quaternion. * Will not destroy the data previously inside the elements of q or w. * result = (q_1^w_1)*(q_2^w_2)* ... *(q_n^w_n) where the sum of w_i is 1. * Lists must be equal in length. * @param q List of quaternions * @param w List of weights * @return This quaternion for chaining */ public Quaternion slerp (Quaternion[] q, float[] w) { //Calculate exponents and multiply everything from left to right set(q[0]).exp(w[0]); for(int i=1;i<q.length;i++) mul(tmp1.set(q[i]).exp(w[i])); nor(); return this; }
/** Averages the given transforms and stores the result in this matrix. Translations and scales are lerped while rotations are * slerped. Does not destroy the data contained in t. * @param t List of transforms * @return This matrix for chaining */ public Matrix4 avg (Matrix4[] t) { final float w = 1.0f / t.length; tmpVec.set(t[0].getScale(tmpUp).scl(w)); quat.set(t[0].getRotation(quat2).exp(w)); tmpForward.set(t[0].getTranslation(tmpUp).scl(w)); for (int i = 1; i < t.length; i++) { tmpVec.add(t[i].getScale(tmpUp).scl(w)); quat.mul(t[i].getRotation(quat2).exp(w)); tmpForward.add(t[i].getTranslation(tmpUp).scl(w)); } quat.nor(); setToScaling(tmpVec); rotate(quat); setTranslation(tmpForward); return this; }
/** Averages the given transforms and stores the result in this matrix. Translations and scales are lerped while rotations are * slerped. Does not destroy the data contained in t. * @param t List of transforms * @return This matrix for chaining */ public Matrix4 avg (Matrix4[] t) { final float w = 1.0f / t.length; tmpVec.set(t[0].getScale(tmpUp).scl(w)); quat.set(t[0].getRotation(quat2).exp(w)); tmpForward.set(t[0].getTranslation(tmpUp).scl(w)); for (int i = 1; i < t.length; i++) { tmpVec.add(t[i].getScale(tmpUp).scl(w)); quat.mul(t[i].getRotation(quat2).exp(w)); tmpForward.add(t[i].getTranslation(tmpUp).scl(w)); } quat.nor(); setToScaling(tmpVec); rotate(quat); setTranslation(tmpForward); return this; }
/** Averages the given transforms with the given weights and stores the result in this matrix. Translations and scales are * lerped while rotations are slerped. Does not destroy the data contained in t or w; Sum of w_i must be equal to 1, or * unexpected results will occur. * @param t List of transforms * @param w List of weights * @return This matrix for chaining */ public Matrix4 avg (Matrix4[] t, float[] w) { tmpVec.set(t[0].getScale(tmpUp).scl(w[0])); quat.set(t[0].getRotation(quat2).exp(w[0])); tmpForward.set(t[0].getTranslation(tmpUp).scl(w[0])); for (int i = 1; i < t.length; i++) { tmpVec.add(t[i].getScale(tmpUp).scl(w[i])); quat.mul(t[i].getRotation(quat2).exp(w[i])); tmpForward.add(t[i].getTranslation(tmpUp).scl(w[i])); } quat.nor(); setToScaling(tmpVec); rotate(quat); setTranslation(tmpForward); return this; }
/** Averages the given transforms with the given weights and stores the result in this matrix. Translations and scales are * lerped while rotations are slerped. Does not destroy the data contained in t or w; Sum of w_i must be equal to 1, or * unexpected results will occur. * @param t List of transforms * @param w List of weights * @return This matrix for chaining */ public Matrix4 avg (Matrix4[] t, float[] w) { tmpVec.set(t[0].getScale(tmpUp).scl(w[0])); quat.set(t[0].getRotation(quat2).exp(w[0])); tmpForward.set(t[0].getTranslation(tmpUp).scl(w[0])); for (int i = 1; i < t.length; i++) { tmpVec.add(t[i].getScale(tmpUp).scl(w[i])); quat.mul(t[i].getRotation(quat2).exp(w[i])); tmpForward.add(t[i].getTranslation(tmpUp).scl(w[i])); } quat.nor(); setToScaling(tmpVec); rotate(quat); setTranslation(tmpForward); return this; }