/// <summary> /// Returns the unit quaternion dot product. /// This is the cosine of the angle between the 2 rotations. /// </summary> /// <param name="r0"></param> /// <param name="r1"></param> /// <returns></returns> public static double Dot(Quaterniond r0, Quaterniond r1) { return(r0.X * r1.X + r0.Y * r1.Y + r0.Z * r1.Z + r0.W * r1.W); }
/// <summary> /// /// </summary> /// <param name="r0"></param> /// <param name="r1"></param> /// <param name="factor"></param> /// <returns></returns> public static Quaterniond Nlerp(Quaterniond r0, Quaterniond r1, double factor) { return(r0.NlerpTo(r1, factor)); }
/// <summary> /// Normalized linear interpolation between this quaternion and another. /// </summary> /// <param name="other"></param> /// <param name="factor"></param> /// <returns></returns> public Quaterniond NlerpTo(Quaterniond other, double factor) { return(LerpTo(other, factor).Unit); }
/// <summary> /// /// </summary> /// <param name="r0"></param> /// <param name="r1"></param> /// <returns></returns> public static Quaterniond CreateFromTo(Quaterniond r0, Quaterniond r1) { return(r1.Apply(r0.Inverse)); }
/// <summary> /// /// </summary> /// <param name="rotation"></param> public AxisAngle3d(Quaterniond rotation) : this() { Set(rotation); }
/// <summary> /// Applies the given rotation to this object. /// </summary> /// <param name="rotation"></param> public void Rotate(Quaterniond rotation) { SetOrthoXY(rotation.Apply(_x), rotation.Apply(_y)); }
/// <summary> /// /// </summary> public OrthoBasis3d(Quaterniond quaternion) : this() { Set(quaternion); }