Beispiel #1
0
 /// <summary>
 /// copy constructor
 /// </summary>
 public qlong(qlong q)
 {
     this.x = q.x;
     this.y = q.y;
     this.z = q.z;
     this.w = q.w;
 }
Beispiel #2
0
        /// <summary>
        /// Tries to convert the string representation of the quaternion into a quaternion representation (using a designated separator), returns false if string was invalid.
        /// </summary>
        public static bool TryParse(string s, string sep, out qlong result)
        {
            result = Zero;
            if (string.IsNullOrEmpty(s))
            {
                return(false);
            }
            var kvp = s.Split(new[] { sep }, StringSplitOptions.None);

            if (kvp.Length != 4)
            {
                return(false);
            }
            long x = 0, y = 0, z = 0, w = 0;
            var  ok = ((long.TryParse(kvp[0].Trim(), out x) && long.TryParse(kvp[1].Trim(), out y)) && (long.TryParse(kvp[2].Trim(), out z) && long.TryParse(kvp[3].Trim(), out w)));

            result = ok ? new qlong(x, y, z, w) : Zero;
            return(ok);
        }
Beispiel #3
0
 /// <summary>
 /// Returns an array with all values
 /// </summary>
 public static long[] Values(qlong q) => q.Values;
Beispiel #4
0
 /// <summary>
 /// Returns a bool4 from component-wise application of GreaterThanEqual (lhs &gt;= rhs).
 /// </summary>
 public static bool4 GreaterThanEqual(long lhs, qlong rhs) => new bool4(lhs >= rhs.x, lhs >= rhs.y, lhs >= rhs.z, lhs >= rhs.w);
Beispiel #5
0
 /// <summary>
 /// Returns a qlong from component-wise application of Lerp (min * (1-a) + max * a).
 /// </summary>
 public static qlong Lerp(qlong min, qlong max, qlong a) => qlong.Lerp(min, max, a);
Beispiel #6
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 public static int GetHashCode(qlong q) => q.GetHashCode();
Beispiel #7
0
 /// <summary>
 /// Returns a bool4 from component-wise application of GreaterThanEqual (lhs &gt;= rhs).
 /// </summary>
 public static bool4 GreaterThanEqual(qlong lhs, qlong rhs) => qlong.GreaterThanEqual(lhs, rhs);
Beispiel #8
0
 /// <summary>
 /// Returns a string representation of this quaternion using a provided seperator and a format and format provider for each component.
 /// </summary>
 public static string ToString(qlong q, string sep, string format, IFormatProvider provider) => q.ToString(sep, format, provider);
Beispiel #9
0
 /// <summary>
 /// Returns true iff this equals rhs component-wise.
 /// </summary>
 public static bool Equals(qlong q, qlong rhs) => q.Equals(rhs);
Beispiel #10
0
 /// <summary>
 /// Returns an enumerator that iterates through all components.
 /// </summary>
 public static IEnumerator <long> GetEnumerator(qlong q) => q.GetEnumerator();
Beispiel #11
0
 /// <summary>
 /// Returns a string representation of this quaternion using a provided seperator.
 /// </summary>
 public static string ToString(qlong q, string sep) => q.ToString(sep);
Beispiel #12
0
 /// <summary>
 /// Returns a qlong from component-wise application of Lerp (min * (1-a) + max * a).
 /// </summary>
 public static qlong Lerp(long min, qlong max, long a) => new qlong(min * (1 - a) + max.x * a, min * (1 - a) + max.y * a, min * (1 - a) + max.z * a, min * (1 - a) + max.w * a);
Beispiel #13
0
 /// <summary>
 /// Returns a qlong from component-wise application of Lerp (min * (1-a) + max * a).
 /// </summary>
 public static qlong Lerp(long min, long max, qlong a) => new qlong(min * (1 - a.x) + max * a.x, min * (1 - a.y) + max * a.y, min * (1 - a.z) + max * a.z, min * (1 - a.w) + max * a.w);
Beispiel #14
0
 /// <summary>
 /// Returns a qlong from component-wise application of Lerp (min * (1-a) + max * a).
 /// </summary>
 public static qlong Lerp(qlong min, long max, long a) => new qlong(min.x * (1 - a) + max * a, min.y * (1 - a) + max * a, min.z * (1 - a) + max * a, min.w * (1 - a) + max * a);
Beispiel #15
0
 /// <summary>
 /// Returns a qlong from component-wise application of Lerp (min * (1-a) + max * a).
 /// </summary>
 public static qlong Lerp(qlong min, long max, qlong a) => new qlong(min.x * (1 - a.x) + max * a.x, min.y * (1 - a.y) + max * a.y, min.z * (1 - a.z) + max * a.z, min.w * (1 - a.w) + max * a.w);
Beispiel #16
0
 /// <summary>
 /// Returns a bool4 from component-wise application of LesserThanEqual (lhs &lt;= rhs).
 /// </summary>
 public static bool4 LesserThanEqual(long lhs, qlong rhs) => new bool4(lhs <= rhs.x, lhs <= rhs.y, lhs <= rhs.z, lhs <= rhs.w);
Beispiel #17
0
 /// <summary>
 /// Returns a bool4 from component-wise application of LesserThanEqual (lhs &lt;= rhs).
 /// </summary>
 public static bool4 LesserThanEqual(qlong lhs, long rhs) => new bool4(lhs.x <= rhs, lhs.y <= rhs, lhs.z <= rhs, lhs.w <= rhs);
Beispiel #18
0
 /// <summary>
 /// Returns a bool4 from component-wise application of LesserThan (lhs &lt; rhs).
 /// </summary>
 public static bool4 LesserThan(qlong lhs, long rhs) => new bool4(lhs.x < rhs, lhs.y < rhs, lhs.z < rhs, lhs.w < rhs);
Beispiel #19
0
 /// <summary>
 /// Returns a string representation of this quaternion using ', ' as a seperator.
 /// </summary>
 public static string ToString(qlong q) => q.ToString();
Beispiel #20
0
 /// <summary>
 /// Returns the inner product (dot product, scalar product) of the two quaternions.
 /// </summary>
 public static long Dot(qlong lhs, qlong rhs) => qlong.Dot(lhs, rhs);
Beispiel #21
0
 /// <summary>
 /// Returns a string representation of this quaternion using a provided seperator and a format for each component.
 /// </summary>
 public static string ToString(qlong q, string sep, string format) => q.ToString(sep, format);
Beispiel #22
0
 /// <summary>
 /// Returns the euclidean length of this quaternion.
 /// </summary>
 public static double Length(qlong q) => q.Length;
Beispiel #23
0
 /// <summary>
 /// Returns the number of components (4).
 /// </summary>
 public static int Count(qlong q) => q.Count;
Beispiel #24
0
 /// <summary>
 /// Returns the squared euclidean length of this quaternion.
 /// </summary>
 public static long LengthSqr(qlong q) => q.LengthSqr;
Beispiel #25
0
 /// <summary>
 /// Returns true iff this equals rhs type- and component-wise.
 /// </summary>
 public static bool Equals(qlong q, object obj) => q.Equals(obj);
Beispiel #26
0
 /// <summary>
 /// Returns the conjugated quaternion
 /// </summary>
 public static qlong Conjugate(qlong q) => q.Conjugate;
Beispiel #27
0
 /// <summary>
 /// Returns a bool4 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bool4 NotEqual(qlong lhs, qlong rhs) => qlong.NotEqual(lhs, rhs);
Beispiel #28
0
 /// <summary>
 /// Returns the inverse quaternion
 /// </summary>
 public static qlong Inverse(qlong q) => q.Inverse;
Beispiel #29
0
 /// <summary>
 /// Returns a bool4 from component-wise application of LesserThan (lhs &lt; rhs).
 /// </summary>
 public static bool4 LesserThan(qlong lhs, qlong rhs) => qlong.LesserThan(lhs, rhs);
Beispiel #30
0
 /// <summary>
 /// Returns the cross product between two quaternions.
 /// </summary>
 public static qlong Cross(qlong q1, qlong q2) => qlong.Cross(q1, q2);