Exemple #1
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public bool2x4(bool4 c0, bool4 c1)
 {
     this.m00 = c0.x;
     this.m01 = c0.y;
     this.m02 = c0.z;
     this.m03 = c0.w;
     this.m10 = c1.x;
     this.m11 = c1.y;
     this.m12 = c1.z;
     this.m13 = c1.w;
 }
Exemple #2
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public bool3x4(bool4 c0, bool4 c1)
 {
     this.m00 = c0.x;
     this.m01 = c0.y;
     this.m02 = c0.z;
     this.m03 = c0.w;
     this.m10 = c1.x;
     this.m11 = c1.y;
     this.m12 = c1.z;
     this.m13 = c1.w;
     this.m20 = false;
     this.m21 = false;
     this.m22 = true;
     this.m23 = false;
 }
Exemple #3
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public bool3x4(bool4 c0, bool4 c1, bool4 c2)
 {
     this.m00 = c0.x;
     this.m01 = c0.y;
     this.m02 = c0.z;
     this.m03 = c0.w;
     this.m10 = c1.x;
     this.m11 = c1.y;
     this.m12 = c1.z;
     this.m13 = c1.w;
     this.m20 = c2.x;
     this.m21 = c2.y;
     this.m22 = c2.z;
     this.m23 = c2.w;
 }
Exemple #4
0
        /// <summary>
        /// Tries to convert the string representation of the vector into a vector representation (using a designated separator), returns false if string was invalid.
        /// </summary>
        public static bool TryParse(string s, string sep, out bool4 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 bool4(x, y, z, w) : Zero;
            return(ok);
        }
Exemple #5
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public bool4x4(bool4 c0, bool4 c1, bool4 c2, bool4 c3)
 {
     this.m00 = c0.x;
     this.m01 = c0.y;
     this.m02 = c0.z;
     this.m03 = c0.w;
     this.m10 = c1.x;
     this.m11 = c1.y;
     this.m12 = c1.z;
     this.m13 = c1.w;
     this.m20 = c2.x;
     this.m21 = c2.y;
     this.m22 = c2.z;
     this.m23 = c2.w;
     this.m30 = c3.x;
     this.m31 = c3.y;
     this.m32 = c3.z;
     this.m33 = c3.w;
 }
Exemple #6
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public bool4x4(bool4 c0, bool4 c1, bool4 c2)
 {
     this.m00 = c0.x;
     this.m01 = c0.y;
     this.m02 = c0.z;
     this.m03 = c0.w;
     this.m10 = c1.x;
     this.m11 = c1.y;
     this.m12 = c1.z;
     this.m13 = c1.w;
     this.m20 = c2.x;
     this.m21 = c2.y;
     this.m22 = c2.z;
     this.m23 = c2.w;
     this.m30 = false;
     this.m31 = false;
     this.m32 = false;
     this.m33 = true;
 }
Exemple #7
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Nor (!(lhs || rhs)).
 /// </summary>
 public static bool4 Nor(bool4 lhs, bool rhs) => new bool4(!(lhs.x || rhs), !(lhs.y || rhs), !(lhs.z || rhs), !(lhs.w || rhs));
Exemple #8
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Or (lhs || rhs).
 /// </summary>
 public static bool4 Or(bool lhs, bool4 rhs) => new bool4(lhs || rhs.x, lhs || rhs.y, lhs || rhs.z, lhs || rhs.w);
Exemple #9
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Or (lhs || rhs).
 /// </summary>
 public static bool4 Or(bool4 lhs, bool rhs) => new bool4(lhs.x || rhs, lhs.y || rhs, lhs.z || rhs, lhs.w || rhs);
Exemple #10
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 bool4 result) => TryParse(s, ", ", out result);
Exemple #11
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Xnor (lhs == rhs).
 /// </summary>
 public static bool4 Xnor(bool lhs, bool4 rhs) => new bool4(lhs == rhs.x, lhs == rhs.y, lhs == rhs.z, lhs == rhs.w);
Exemple #12
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Xor (lhs != rhs).
 /// </summary>
 public static bool4 Xor(bool4 lhs, bool rhs) => new bool4(lhs.x != rhs, lhs.y != rhs, lhs.z != rhs, lhs.w != rhs);
Exemple #13
0
 /// <summary>
 /// Returns a bool4 from component-wise application of And (lhs &amp;&amp; rhs).
 /// </summary>
 public static bool4 And(bool4 lhs, bool rhs) => new bool4(lhs.x && rhs, lhs.y && rhs, lhs.z && rhs, lhs.w && rhs);
Exemple #14
0
 /// <summary>
 /// Returns a bool4 from component-wise application of And (lhs &amp;&amp; rhs).
 /// </summary>
 public static bool4 And(bool4 lhs, bool4 rhs) => new bool4(lhs.x && rhs.x, lhs.y && rhs.y, lhs.z && rhs.z, lhs.w && rhs.w);
Exemple #15
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Not (!v).
 /// </summary>
 public static bool4 Not(bool4 v) => new bool4(!v.x, !v.y, !v.z, !v.w);
Exemple #16
0
 /// <summary>
 /// Returns a bool4 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bool4 NotEqual(bool lhs, bool4 rhs) => new bool4(lhs != rhs.x, lhs != rhs.y, lhs != rhs.z, lhs != rhs.w);
Exemple #17
0
 /// <summary>
 /// Returns a bool4 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bool4 NotEqual(bool4 lhs, bool rhs) => new bool4(lhs.x != rhs, lhs.y != rhs, lhs.z != rhs, lhs.w != rhs);
Exemple #18
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Equal (lhs == rhs).
 /// </summary>
 public static bool4 Equal(bool4 lhs, bool4 rhs) => new bool4(lhs.x == rhs.x, lhs.y == rhs.y, lhs.z == rhs.z, lhs.w == rhs.w);
Exemple #19
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Nor (!(lhs || rhs)).
 /// </summary>
 public static bool4 Nor(bool lhs, bool4 rhs) => new bool4(!(lhs || rhs.x), !(lhs || rhs.y), !(lhs || rhs.z), !(lhs || rhs.w));
Exemple #20
0
 /// <summary>
 /// Returns a bool4 from component-wise application of And (lhs &amp;&amp; rhs).
 /// </summary>
 public static bool4 And(bool lhs, bool4 rhs) => new bool4(lhs && rhs.x, lhs && rhs.y, lhs && rhs.z, lhs && rhs.w);
Exemple #21
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Xor (lhs != rhs).
 /// </summary>
 public static bool4 Xor(bool4 lhs, bool4 rhs) => new bool4(lhs.x != rhs.x, lhs.y != rhs.y, lhs.z != rhs.z, lhs.w != rhs.w);
Exemple #22
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Nand (!(lhs &amp;&amp; rhs)).
 /// </summary>
 public static bool4 Nand(bool4 lhs, bool rhs) => new bool4(!(lhs.x && rhs), !(lhs.y && rhs), !(lhs.z && rhs), !(lhs.w && rhs));
Exemple #23
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Xnor (lhs == rhs).
 /// </summary>
 public static bool4 Xnor(bool4 lhs, bool rhs) => new bool4(lhs.x == rhs, lhs.y == rhs, lhs.z == rhs, lhs.w == rhs);
Exemple #24
0
 /// <summary>
 /// from-vector constructor (additional fields are truncated)
 /// </summary>
 public bool3(bool4 v)
 {
     this.x = v.x;
     this.y = v.y;
     this.z = v.z;
 }
Exemple #25
0
 /// <summary>
 /// Returns true iff this equals rhs component-wise.
 /// </summary>
 public bool Equals(bool4 rhs) => ((x.Equals(rhs.x) && y.Equals(rhs.y)) && (z.Equals(rhs.z) && w.Equals(rhs.w)));
Exemple #26
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Nand (!(lhs &amp;&amp; rhs)).
 /// </summary>
 public static bool4 Nand(bool4 lhs, bool4 rhs) => bool4.Nand(lhs, rhs);
Exemple #27
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Or (lhs || rhs).
 /// </summary>
 public static bool4 Or(bool4 lhs, bool4 rhs) => new bool4(lhs.x || rhs.x, lhs.y || rhs.y, lhs.z || rhs.z, lhs.w || rhs.w);
Exemple #28
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Or (lhs || rhs).
 /// </summary>
 public static bool4 Or(bool4 lhs, bool4 rhs) => bool4.Or(lhs, rhs);
Exemple #29
0
 /// <summary>
 /// Returns a bool4 from component-wise application of Nand (!(lhs &amp;&amp; rhs)).
 /// </summary>
 public static bool4 Nand(bool lhs, bool4 rhs) => new bool4(!(lhs && rhs.x), !(lhs && rhs.y), !(lhs && rhs.z), !(lhs && rhs.w));
Exemple #30
0
 /// <summary>
 /// Returns a bool4 from component-wise application of And (lhs &amp;&amp; rhs).
 /// </summary>
 public static bool4 And(bool4 lhs, bool4 rhs) => bool4.And(lhs, rhs);