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

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

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