/// <summary> /// Applies this transformation to the given vector. /// </summary> /// <param name="vector"></param> /// <returns></returns> public Vec4d Apply(Vec4d vector) { return(new Vec4d( Vec4d.Dot(Row0, vector), Vec4d.Dot(Row1, vector), Vec4d.Dot(Row2, vector), Vec4d.Dot(Row3, vector) )); }
/// <summary> /// Linear interpolation between this quaternion and another. /// </summary> /// <param name="other"></param> /// <param name="factor"></param> /// <returns></returns> public Quaterniond LerpTo(Quaterniond other, double factor) { var ca = Vec4d.Dot(this, other); if (ca < 0.0) { return(new Quaterniond( X + (-other.X - X) * factor, Y + (-other.Y - Y) * factor, Z + (-other.Z - Z) * factor, W + (-other.W - W) * factor )); } else { return(new Quaterniond( X + (other.X - X) * factor, Y + (other.Y - Y) * factor, Z + (other.Z - Z) * factor, W + (other.W - W) * factor )); } }