/// <summary> /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix. /// </summary> public bool3x4(bool3 c0, bool3 c1, bool3 c2) { this.m00 = c0.x; this.m01 = c0.y; this.m02 = c0.z; this.m03 = false; this.m10 = c1.x; this.m11 = c1.y; this.m12 = c1.z; this.m13 = false; this.m20 = c2.x; this.m21 = c2.y; this.m22 = c2.z; this.m23 = false; }
/// <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 bool3 result) { result = Zero; if (string.IsNullOrEmpty(s)) { return(false); } var kvp = s.Split(new[] { sep }, StringSplitOptions.None); if (kvp.Length != 3) { return(false); } bool x = false, y = false, z = false; var ok = ((bool.TryParse(kvp[0].Trim(), out x) && bool.TryParse(kvp[1].Trim(), out y)) && bool.TryParse(kvp[2].Trim(), out z)); result = ok ? new bool3(x, y, z) : Zero; return(ok); }
/// <summary> /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix. /// </summary> public bool4x4(bool3 c0, bool3 c1, bool3 c2, bool3 c3) { this.m00 = c0.x; this.m01 = c0.y; this.m02 = c0.z; this.m03 = false; this.m10 = c1.x; this.m11 = c1.y; this.m12 = c1.z; this.m13 = false; this.m20 = c2.x; this.m21 = c2.y; this.m22 = c2.z; this.m23 = false; this.m30 = c3.x; this.m31 = c3.y; this.m32 = c3.z; this.m33 = true; }
/// <summary> /// Returns a bool3 from component-wise application of Not (!v). /// </summary> public static bool3 Not(bool3 v) => new bool3(!v.x, !v.y, !v.z);
/// <summary> /// Returns a bool3 from component-wise application of NotEqual (lhs != rhs). /// </summary> public static bool3 NotEqual(bool lhs, bool3 rhs) => new bool3(lhs != rhs.x, lhs != rhs.y, lhs != rhs.z);
/// <summary> /// Returns a bool3 from component-wise application of Nor (!(lhs || rhs)). /// </summary> public static bool3 Nor(bool3 lhs, bool rhs) => new bool3(!(lhs.x || rhs), !(lhs.y || rhs), !(lhs.z || rhs));
/// <summary> /// Returns a string representation of this vector using a provided seperator and a format provider for each component. /// </summary> public static string ToString(bool3 v, string sep, IFormatProvider provider) => v.ToString(sep, provider);
/// <summary> /// Returns a bool3 from component-wise application of Nand (!(lhs && rhs)). /// </summary> public static bool3 Nand(bool3 lhs, bool rhs) => new bool3(!(lhs.x && rhs), !(lhs.y && rhs), !(lhs.z && rhs));
/// <summary> /// Returns a bool3 from component-wise application of Or (lhs || rhs). /// </summary> public static bool3 Or(bool3 lhs, bool rhs) => new bool3(lhs.x || rhs, lhs.y || rhs, lhs.z || rhs);
/// <summary> /// Returns a bool3 from component-wise application of NotEqual (lhs != rhs). /// </summary> public static bool3 NotEqual(bool3 lhs, bool3 rhs) => bool3.NotEqual(lhs, rhs);
/// <summary> /// Returns a bool3 from component-wise application of Not (!v). /// </summary> public static bool3 Not(bool3 v) => bool3.Not(v);
/// <summary> /// Returns a hash code for this instance. /// </summary> public static int GetHashCode(bool3 v) => v.GetHashCode();
/// <summary> /// Returns a bool3 from component-wise application of Equal (lhs == rhs). /// </summary> public static bool3 Equal(bool3 lhs, bool3 rhs) => bool3.Equal(lhs, rhs);
/// <summary> /// Returns true iff this equals rhs type- and component-wise. /// </summary> public static bool Equals(bool3 v, object obj) => v.Equals(obj);
/// <summary> /// Returns true iff this equals rhs component-wise. /// </summary> public static bool Equals(bool3 v, bool3 rhs) => v.Equals(rhs);
/// <summary> /// Returns the number of components (3). /// </summary> public static int Count(bool3 v) => v.Count;
/// <summary> /// Returns a bool3 from component-wise application of And (lhs && rhs). /// </summary> public static bool3 And(bool3 lhs, bool rhs) => new bool3(lhs.x && rhs, lhs.y && rhs, lhs.z && rhs);
/// <summary> /// Returns true iff this equals rhs component-wise. /// </summary> public bool Equals(bool3 rhs) => ((x.Equals(rhs.x) && y.Equals(rhs.y)) && z.Equals(rhs.z));
/// <summary> /// Returns a bool3 from component-wise application of And (lhs && rhs). /// </summary> public static bool3 And(bool lhs, bool3 rhs) => new bool3(lhs && rhs.x, lhs && rhs.y, lhs && rhs.z);
/// <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 bool3 result) => TryParse(s, ", ", out result);
/// <summary> /// Returns a bool3 from component-wise application of Nand (!(lhs && rhs)). /// </summary> public static bool3 Nand(bool lhs, bool3 rhs) => new bool3(!(lhs && rhs.x), !(lhs && rhs.y), !(lhs && rhs.z));
/// <summary> /// Returns a bool3 from component-wise application of Xor (lhs != rhs). /// </summary> public static bool3 Xor(bool3 lhs, bool rhs) => new bool3(lhs.x != rhs, lhs.y != rhs, lhs.z != rhs);
/// <summary> /// Returns a bool3 from component-wise application of Or (lhs || rhs). /// </summary> public static bool3 Or(bool lhs, bool3 rhs) => new bool3(lhs || rhs.x, lhs || rhs.y, lhs || rhs.z);
/// <summary> /// Returns a bool3 from component-wise application of Xnor (lhs == rhs). /// </summary> public static bool3 Xnor(bool lhs, bool3 rhs) => new bool3(lhs == rhs.x, lhs == rhs.y, lhs == rhs.z);
/// <summary> /// Returns a bool3 from component-wise application of Nor (!(lhs || rhs)). /// </summary> public static bool3 Nor(bool lhs, bool3 rhs) => new bool3(!(lhs || rhs.x), !(lhs || rhs.y), !(lhs || rhs.z));
/// <summary> /// Returns a string representation of this vector using a provided seperator. /// </summary> public static string ToString(bool3 v, string sep) => v.ToString(sep);
/// <summary> /// Returns a bool3 from component-wise application of Xnor (lhs == rhs). /// </summary> public static bool3 Xnor(bool3 lhs, bool rhs) => new bool3(lhs.x == rhs, lhs.y == rhs, lhs.z == rhs);
/// <summary> /// Returns a bool3 from component-wise application of Equal (lhs == rhs). /// </summary> public static bool3 Equal(bool3 lhs, bool rhs) => new bool3(lhs.x == rhs, lhs.y == rhs, lhs.z == rhs);
/// <summary> /// from-vector constructor /// </summary> public bool3(bool3 v) { this.x = v.x; this.y = v.y; this.z = v.z; }
/// <summary> /// Returns a bool3 from component-wise application of NotEqual (lhs != rhs). /// </summary> public static bool3 NotEqual(bool3 lhs, bool rhs) => new bool3(lhs.x != rhs, lhs.y != rhs, lhs.z != rhs);