public static aQuat Slerp(aQuat start, aQuat end, float percent) { var cos = aQuat.DotProduct(start, end); if (cos < 0.0f) { cos = -cos; end = -end; } if ((1.0f - cos) > Single.Epsilon) { var angle = (float)SystemMath.Acos(cos); var vector = new aVec3( (float)SystemMath.Sin(angle * (1.0f - percent)), (float)SystemMath.Sin(angle * percent), (float)SystemMath.Sin(angle) ); return(new aQuat( (start.x * vector.x + end.x * vector.y) / vector.z, (start.y * vector.x + end.y * vector.y) / vector.z, (start.z * vector.x + end.z * vector.y) / vector.z, (start.w * vector.x + end.w * vector.y) / vector.z )); } return(aQuat.Lerp(start, end, percent)); }
public static bool Approximately(aQuat first, aQuat second, float deviation) { return(aMath.Approximately(first.x, second.x, deviation) && aMath.Approximately(first.y, second.y, deviation) && aMath.Approximately(first.z, second.z, deviation) && aMath.Approximately(first.w, second.w, deviation)); }
public static aQuat Lerp(aQuat start, aQuat end, float percent) { return(new aQuat( aMath.Lerp(start.x, end.x, percent), aMath.Lerp(start.y, end.y, percent), aMath.Lerp(start.z, end.z, percent), aMath.Lerp(start.w, end.w, percent) )); }
public static aQuat Slerp(aQuat start, aQuat end, float percent) { var cos = aQuat.DotProduct(start, end); if (cos < 0.0f) { cos = -cos; end = -end; } if ((1.0f - cos) > Single.Epsilon) { var angle = (float)SystemMath.Acos(cos); var vector = new aVec3( (float)SystemMath.Sin(angle * (1.0f - percent)), (float)SystemMath.Sin(angle * percent), (float)SystemMath.Sin(angle) ); return new aQuat( (start.x * vector.x + end.x * vector.y) / vector.z, (start.y * vector.x + end.y * vector.y) / vector.z, (start.z * vector.x + end.z * vector.y) / vector.z, (start.w * vector.x + end.w * vector.y) / vector.z ); } return aQuat.Lerp(start, end, percent); }
public static aQuat Lerp(aQuat start, aQuat end, float percent) { return new aQuat( aMath.Lerp(start.x, end.x, percent), aMath.Lerp(start.y, end.y, percent), aMath.Lerp(start.z, end.z, percent), aMath.Lerp(start.w, end.w, percent) ); }
public static float DotProduct(aQuat a, aQuat b) { return (a.x * b.x + a.y * b.y + a.z * b.z * a.w * b.w); }
public static bool Approximately(aQuat first, aQuat second, float deviation) { return (aMath.Approximately(first.x, second.x, deviation) && aMath.Approximately(first.y, second.y, deviation) && aMath.Approximately(first.z, second.z, deviation) && aMath.Approximately(first.w, second.w, deviation)); }
public static bool Approximately(aQuat first, aQuat second) { return Approximately(first, second, Single.Epsilon); }
public static float DotProduct(aQuat a, aQuat b) { return(a.x * b.x + a.y * b.y + a.z * b.z * a.w * b.w); }
public static bool Approximately(aQuat first, aQuat second) { return(Approximately(first, second, Single.Epsilon)); }