Beispiel #1
0
 /// <summary>
 /// copy constructor
 /// </summary>
 public uquat(uquat 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 uquat 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 uquat(x, y, z, w) : Zero;
            return(ok);
        }
Beispiel #3
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bvec4 NotEqual(uquat lhs, uint rhs) => new bvec4(lhs.x != rhs, lhs.y != rhs, lhs.z != rhs, lhs.w != rhs);
Beispiel #4
0
 /// <summary>
 /// Returns the number of components (4).
 /// </summary>
 public static int Count(uquat q) => q.Count;
Beispiel #5
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bvec4 NotEqual(uquat lhs, uquat rhs) => new bvec4(lhs.x != rhs.x, lhs.y != rhs.y, lhs.z != rhs.z, lhs.w != rhs.w);
Beispiel #6
0
 /// <summary>
 /// Returns a uquat from component-wise application of Lerp (min * (1-a) + max * a).
 /// </summary>
 public static uquat Lerp(uquat min, uint max, uint a) => new uquat(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 #7
0
 /// <summary>
 /// Returns a uquat from component-wise application of Lerp (min * (1-a) + max * a).
 /// </summary>
 public static uquat Lerp(uint min, uint max, uquat a) => new uquat(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 #8
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of GreaterThanEqual (lhs &gt;= rhs).
 /// </summary>
 public static bvec4 GreaterThanEqual(uquat lhs, uint rhs) => new bvec4(lhs.x >= rhs, lhs.y >= rhs, lhs.z >= rhs, lhs.w >= rhs);
Beispiel #9
0
 /// <summary>
 /// Returns true iff this equals rhs type- and component-wise.
 /// </summary>
 public static bool Equals(uquat q, object obj) => q.Equals(obj);
Beispiel #10
0
 /// <summary>
 /// Returns true iff this equals rhs component-wise.
 /// </summary>
 public bool Equals(uquat rhs) => ((x.Equals(rhs.x) && y.Equals(rhs.y)) && (z.Equals(rhs.z) && w.Equals(rhs.w)));
Beispiel #11
0
 /// <summary>
 /// Tries to convert the string representation of the quaternion into a quaternion representation (using ', ' as a separator), returns false if string was invalid.
 /// </summary>
 public static bool TryParse(string s, out uquat result) => TryParse(s, ", ", out result);
Beispiel #12
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of GreaterThanEqual (lhs &gt;= rhs).
 /// </summary>
 public static bvec4 GreaterThanEqual(uquat lhs, uquat rhs) => uquat.GreaterThanEqual(lhs, rhs);
Beispiel #13
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of LesserThan (lhs &lt; rhs).
 /// </summary>
 public static bvec4 LesserThan(uquat lhs, uquat rhs) => uquat.LesserThan(lhs, rhs);
Beispiel #14
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bvec4 NotEqual(uquat lhs, uquat rhs) => uquat.NotEqual(lhs, rhs);
Beispiel #15
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of Equal (lhs == rhs).
 /// </summary>
 public static bvec4 Equal(uquat lhs, uquat rhs) => uquat.Equal(lhs, rhs);
Beispiel #16
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 public static int GetHashCode(uquat q) => q.GetHashCode();
Beispiel #17
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bvec4 NotEqual(uint lhs, uquat rhs) => new bvec4(lhs != rhs.x, lhs != rhs.y, lhs != rhs.z, lhs != rhs.w);
Beispiel #18
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of LesserThan (lhs &lt; rhs).
 /// </summary>
 public static bvec4 LesserThan(uquat lhs, uint rhs) => new bvec4(lhs.x < rhs, lhs.y < rhs, lhs.z < rhs, lhs.w < rhs);
Beispiel #19
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of GreaterThan (lhs &gt; rhs).
 /// </summary>
 public static bvec4 GreaterThan(uquat lhs, uint rhs) => new bvec4(lhs.x > rhs, lhs.y > rhs, lhs.z > rhs, lhs.w > rhs);
Beispiel #20
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of LesserThanEqual (lhs &lt;= rhs).
 /// </summary>
 public static bvec4 LesserThanEqual(uint lhs, uquat rhs) => new bvec4(lhs <= rhs.x, lhs <= rhs.y, lhs <= rhs.z, lhs <= rhs.w);
Beispiel #21
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of GreaterThanEqual (lhs &gt;= rhs).
 /// </summary>
 public static bvec4 GreaterThanEqual(uint lhs, uquat rhs) => new bvec4(lhs >= rhs.x, lhs >= rhs.y, lhs >= rhs.z, lhs >= rhs.w);
Beispiel #22
0
 /// <summary>
 /// Returns true iff this equals rhs component-wise.
 /// </summary>
 public static bool Equals(uquat q, uquat rhs) => q.Equals(rhs);
Beispiel #23
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of LesserThanEqual (lhs &lt;= rhs).
 /// </summary>
 public static bvec4 LesserThanEqual(uquat lhs, uint rhs) => new bvec4(lhs.x <= rhs, lhs.y <= rhs, lhs.z <= rhs, lhs.w <= rhs);
Beispiel #24
0
 /// <summary>
 /// Returns the inner product (dot product, scalar product) of the two quaternions.
 /// </summary>
 public static uint Dot(uquat lhs, uquat rhs) => ((lhs.x * rhs.x + lhs.y * rhs.y) + (lhs.z * rhs.z + lhs.w * rhs.w));
Beispiel #25
0
 /// <summary>
 /// Returns a uquat from component-wise application of Lerp (min * (1-a) + max * a).
 /// </summary>
 public static uquat Lerp(uquat min, uquat max, uquat a) => new uquat(min.x * (1 - a.x) + max.x * a.x, min.y * (1 - a.y) + max.y * a.y, min.z * (1 - a.z) + max.z * a.z, min.w * (1 - a.w) + max.w * a.w);
Beispiel #26
0
 /// <summary>
 /// Returns the cross product between two quaternions.
 /// </summary>
 public static uquat Cross(uquat q1, uquat q2) => new uquat(q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y, q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z, q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x, q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z);
Beispiel #27
0
 /// <summary>
 /// Returns a uquat from component-wise application of Lerp (min * (1-a) + max * a).
 /// </summary>
 public static uquat Lerp(uint min, uquat max, uint a) => new uquat(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 #28
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of Equal (lhs == rhs).
 /// </summary>
 public static bvec4 Equal(uquat lhs, uquat rhs) => new bvec4(lhs.x == rhs.x, lhs.y == rhs.y, lhs.z == rhs.z, lhs.w == rhs.w);
Beispiel #29
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of Equal (lhs == rhs).
 /// </summary>
 public static bvec4 Equal(uquat lhs, uint rhs) => new bvec4(lhs.x == rhs, lhs.y == rhs, lhs.z == rhs, lhs.w == rhs);
Beispiel #30
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(uquat q, string sep, string format, IFormatProvider provider) => q.ToString(sep, format, provider);