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

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

            result = ok ? new qbool(x, y, z, w) : Zero;
            return(ok);
        }
示例#3
0
 /// <summary>
 /// Returns a qbool from component-wise application of And (lhs &amp;&amp; rhs).
 /// </summary>
 public static qbool And(bool lhs, qbool rhs) => new qbool(lhs && rhs.x, lhs && rhs.y, lhs && rhs.z, lhs && rhs.w);
示例#4
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Equal (lhs == rhs).
 /// </summary>
 public static bool4 Equal(qbool lhs, qbool rhs) => qbool.Equal(lhs, rhs);
示例#5
0
 /// <summary>
 /// Returns a qbool from component-wise application of And (lhs &amp;&amp; rhs).
 /// </summary>
 public static qbool And(qbool lhs, bool rhs) => new qbool(lhs.x && rhs, lhs.y && rhs, lhs.z && rhs, lhs.w && rhs);
示例#6
0
 /// <summary>
 /// Returns a qbool from component-wise application of Xor (lhs != rhs).
 /// </summary>
 public static qbool Xor(qbool lhs, bool rhs) => new qbool(lhs.x != rhs, lhs.y != rhs, lhs.z != rhs, lhs.w != rhs);
示例#7
0
 /// <summary>
 /// Returns a qbool from component-wise application of Xnor (lhs == rhs).
 /// </summary>
 public static qbool Xnor(bool lhs, qbool rhs) => new qbool(lhs == rhs.x, lhs == rhs.y, lhs == rhs.z, lhs == rhs.w);
示例#8
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Not (!v).
 /// </summary>
 public static bool4 Not(qbool v) => qbool.Not(v);
示例#9
0
 /// <summary>
 /// Returns a qbool from component-wise application of Nor (!(lhs || rhs)).
 /// </summary>
 public static qbool Nor(bool lhs, qbool rhs) => new qbool(!(lhs || rhs.x), !(lhs || rhs.y), !(lhs || rhs.z), !(lhs || rhs.w));
示例#10
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 qbool result) => TryParse(s, ", ", out result);
示例#11
0
 /// <summary>
 /// Returns a qbool from component-wise application of Or (lhs || rhs).
 /// </summary>
 public static qbool Or(qbool lhs, qbool rhs) => new qbool(lhs.x || rhs.x, lhs.y || rhs.y, lhs.z || rhs.z, lhs.w || rhs.w);
示例#12
0
 /// <summary>
 /// Returns a qbool from component-wise application of Nor (!(lhs || rhs)).
 /// </summary>
 public static qbool Nor(qbool lhs, qbool rhs) => qbool.Nor(lhs, rhs);
示例#13
0
 /// <summary>
 /// Returns true iff this equals rhs component-wise.
 /// </summary>
 public bool Equals(qbool rhs) => ((x.Equals(rhs.x) && y.Equals(rhs.y)) && (z.Equals(rhs.z) && w.Equals(rhs.w)));
示例#14
0
 /// <summary>
 /// Returns a qbool from component-wise application of Or (lhs || rhs).
 /// </summary>
 public static qbool Or(qbool lhs, qbool rhs) => qbool.Or(lhs, rhs);
示例#15
0
 /// <summary>
 /// Returns a qbool from component-wise application of Nand (!(lhs &amp;&amp; rhs)).
 /// </summary>
 public static qbool Nand(qbool lhs, qbool rhs) => qbool.Nand(lhs, rhs);
示例#16
0
 /// <summary>
 /// Returns a qbool from component-wise application of And (lhs &amp;&amp; rhs).
 /// </summary>
 public static qbool And(qbool lhs, qbool rhs) => qbool.And(lhs, rhs);
示例#17
0
 /// <summary>
 /// Returns a qbool from component-wise application of Nand (!(lhs &amp;&amp; rhs)).
 /// </summary>
 public static qbool Nand(qbool lhs, bool rhs) => new qbool(!(lhs.x && rhs), !(lhs.y && rhs), !(lhs.z && rhs), !(lhs.w && rhs));
示例#18
0
 /// <summary>
 /// Returns a qbool from component-wise application of Or (lhs || rhs).
 /// </summary>
 public static qbool Or(bool lhs, qbool rhs) => new qbool(lhs || rhs.x, lhs || rhs.y, lhs || rhs.z, lhs || rhs.w);
示例#19
0
 /// <summary>
 /// Returns a qbool from component-wise application of Nand (!(lhs &amp;&amp; rhs)).
 /// </summary>
 public static qbool Nand(bool lhs, qbool rhs) => new qbool(!(lhs && rhs.x), !(lhs && rhs.y), !(lhs && rhs.z), !(lhs && rhs.w));
示例#20
0
 /// <summary>
 /// Returns a bool4 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bool4 NotEqual(qbool lhs, qbool rhs) => qbool.NotEqual(lhs, rhs);
示例#21
0
 /// <summary>
 /// Returns a qbool from component-wise application of Or (lhs || rhs).
 /// </summary>
 public static qbool Or(qbool lhs, bool rhs) => new qbool(lhs.x || rhs, lhs.y || rhs, lhs.z || rhs, lhs.w || rhs);
示例#22
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Equal (lhs == rhs).
 /// </summary>
 public static bool4 Equal(qbool lhs, bool rhs) => new bool4(lhs.x == rhs, lhs.y == rhs, lhs.z == rhs, lhs.w == rhs);
示例#23
0
 /// <summary>
 /// Returns a qbool from component-wise application of Nor (!(lhs || rhs)).
 /// </summary>
 public static qbool Nor(qbool lhs, bool rhs) => new qbool(!(lhs.x || rhs), !(lhs.y || rhs), !(lhs.z || rhs), !(lhs.w || rhs));
示例#24
0
 /// <summary>
 /// Returns a bool4 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bool4 NotEqual(qbool lhs, bool rhs) => new bool4(lhs.x != rhs, lhs.y != rhs, lhs.z != rhs, lhs.w != rhs);
示例#25
0
 /// <summary>
 /// Returns a qbool from component-wise application of Xor (lhs != rhs).
 /// </summary>
 public static qbool Xor(qbool lhs, qbool rhs) => new qbool(lhs.x != rhs.x, lhs.y != rhs.y, lhs.z != rhs.z, lhs.w != rhs.w);
示例#26
0
 /// <summary>
 /// Returns a bool4 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bool4 NotEqual(bool lhs, qbool rhs) => new bool4(lhs != rhs.x, lhs != rhs.y, lhs != rhs.z, lhs != rhs.w);
示例#27
0
 /// <summary>
 /// Returns a qbool from component-wise application of Xnor (lhs == rhs).
 /// </summary>
 public static qbool Xnor(qbool lhs, bool rhs) => new qbool(lhs.x == rhs, lhs.y == rhs, lhs.z == rhs, lhs.w == rhs);
示例#28
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Not (!v).
 /// </summary>
 public static bool4 Not(qbool v) => new bool4(!v.x, !v.y, !v.z, !v.w);
示例#29
0
 /// <summary>
 /// Returns a qbool from component-wise application of And (lhs &amp;&amp; rhs).
 /// </summary>
 public static qbool And(qbool lhs, qbool rhs) => new qbool(lhs.x && rhs.x, lhs.y && rhs.y, lhs.z && rhs.z, lhs.w && rhs.w);
示例#30
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 public static int GetHashCode(qbool q) => q.GetHashCode();