Esempio n. 1
0
 /// <summary>
 /// copy constructor
 /// </summary>
 public quint(quint q)
 {
     this.x = q.x;
     this.y = q.y;
     this.z = q.z;
     this.w = q.w;
 }
Esempio n. 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 quint result)
        {
            result = Zero;
            if (string.IsNullOrEmpty(s))
            {
                return(false);
            }
            var kvp = s.Split(new[] { sep }, StringSplitOptions.None);

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

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