Example #1
0
 /// <summary>
 /// Returns a bool2 from component-wise application of Or (lhs || rhs).
 /// </summary>
 public static bool2 Or(bool lhs, bool2 rhs) => new bool2(lhs || rhs.x, lhs || rhs.y);
Example #2
0
 /// <summary>
 /// Returns a bool2 from component-wise application of Nor (!(lhs || rhs)).
 /// </summary>
 public static bool2 Nor(bool2 lhs, bool rhs) => new bool2(!(lhs.x || rhs), !(lhs.y || rhs));
Example #3
0
 /// <summary>
 /// Returns a bool2 from component-wise application of Nand (!(lhs &amp;&amp; rhs)).
 /// </summary>
 public static bool2 Nand(bool lhs, bool2 rhs) => new bool2(!(lhs && rhs.x), !(lhs && rhs.y));
Example #4
0
 /// <summary>
 /// Returns a bool2 from component-wise application of Or (lhs || rhs).
 /// </summary>
 public static bool2 Or(bool2 lhs, bool rhs) => new bool2(lhs.x || rhs, lhs.y || rhs);
Example #5
0
 /// <summary>
 /// Tries to convert the string representation of the vector into a vector representation (using ', ' as a separator), returns false if string was invalid.
 /// </summary>
 public static bool TryParse(string s, out bool2 result) => TryParse(s, ", ", out result);
Example #6
0
 /// <summary>
 /// Returns a bool2 from component-wise application of Nand (!(lhs &amp;&amp; rhs)).
 /// </summary>
 public static bool2 Nand(bool2 lhs, bool rhs) => new bool2(!(lhs.x && rhs), !(lhs.y && rhs));
Example #7
0
 /// <summary>
 /// Returns a bool2 from component-wise application of And (lhs &amp;&amp; rhs).
 /// </summary>
 public static bool2 And(bool2 lhs, bool rhs) => new bool2(lhs.x && rhs, lhs.y && rhs);
Example #8
0
 /// <summary>
 /// Returns a bool2 from component-wise application of Xnor (lhs == rhs).
 /// </summary>
 public static bool2 Xnor(bool2 lhs, bool rhs) => new bool2(lhs.x == rhs, lhs.y == rhs);
Example #9
0
 /// <summary>
 /// Returns a bool2 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bool2 NotEqual(bool lhs, bool2 rhs) => new bool2(lhs != rhs.x, lhs != rhs.y);
Example #10
0
 /// <summary>
 /// Returns a bool2 from component-wise application of Not (!v).
 /// </summary>
 public static bool2 Not(bool2 v) => new bool2(!v.x, !v.y);
Example #11
0
 /// <summary>
 /// Returns a bool2 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bool2 NotEqual(bool2 lhs, bool rhs) => new bool2(lhs.x != rhs, lhs.y != rhs);
Example #12
0
 /// <summary>
 /// Returns a bool2 from component-wise application of Equal (lhs == rhs).
 /// </summary>
 public static bool2 Equal(bool lhs, bool2 rhs) => new bool2(lhs == rhs.x, lhs == rhs.y);
Example #13
0
 /// <summary>
 /// Returns a bool2 from component-wise application of Equal (lhs == rhs).
 /// </summary>
 public static bool2 Equal(bool2 lhs, bool rhs) => new bool2(lhs.x == rhs, lhs.y == rhs);
Example #14
0
 /// <summary>
 /// Returns a bool2 from component-wise application of Nor (!(lhs || rhs)).
 /// </summary>
 public static bool2 Nor(bool lhs, bool2 rhs) => new bool2(!(lhs || rhs.x), !(lhs || rhs.y));
Example #15
0
 /// <summary>
 /// Returns a bool2 from component-wise application of And (lhs &amp;&amp; rhs).
 /// </summary>
 public static bool2 And(bool lhs, bool2 rhs) => new bool2(lhs && rhs.x, lhs && rhs.y);
Example #16
0
 /// <summary>
 /// Returns a bool2 from component-wise application of Xor (lhs != rhs).
 /// </summary>
 public static bool2 Xor(bool2 lhs, bool rhs) => new bool2(lhs.x != rhs, lhs.y != rhs);
Example #17
0
 /// <summary>
 /// from-vector constructor
 /// </summary>
 public bool2(bool2 v)
 {
     this.x = v.x;
     this.y = v.y;
 }
Example #18
0
 /// <summary>
 /// Returns a bool2 from component-wise application of Xnor (lhs == rhs).
 /// </summary>
 public static bool2 Xnor(bool lhs, bool2 rhs) => new bool2(lhs == rhs.x, lhs == rhs.y);
Example #19
0
 /// <summary>
 /// Returns true iff this equals rhs component-wise.
 /// </summary>
 public bool Equals(bool2 rhs) => (x.Equals(rhs.x) && y.Equals(rhs.y));