/// <summary> /// 四元数的积 /// </summary> /// <param name="q1"></param> /// <param name="q2"></param> /// <returns></returns> public static StrQuaternions operator *(StrQuaternions q1, StrQuaternions q2) { StrQuaternions q = new StrQuaternions(); q.T = "(" + q1.T + "*" + q2.T + "-" + q1.V * q2.V + ")"; q.V = q1.T * q2.V + q2.T * q1.V + q1.V.XMultpy(q2.V); return(q); }
/// <summary> /// 同除以一个实数 /// </summary> /// <param name="q"></param> /// <param name="f"></param> /// <returns></returns> public static StrQuaternions operator /(StrQuaternions q, string f) { StrQuaternions t = new StrQuaternions(); t.T = q.T + "/" + f; t.V = q.V / f; return(t); }
/// <summary> /// 四元数的和 /// </summary> /// <param name="q1"></param> /// <param name="q2"></param> /// <returns></returns> public static StrQuaternions operator +(StrQuaternions q1, StrQuaternions q2) { StrQuaternions q = new StrQuaternions(); if (q1.T == "0") { } return(new StrQuaternions("(" + q1.T + "+" + q2.T + ")", q1.V + q2.V)); }