/// <summary> /// vector-and-scalar constructor (CAUTION: not angle-axis, use FromAngleAxis instead) /// </summary> public bquat(bvec3 v, bool s) { this.x = v.x; this.y = v.y; this.z = v.z; this.w = s; }
/// <summary> /// from-vector-and-value constructor /// </summary> public bvec4(bvec3 v, bool w) { this.x = v.x; this.y = v.y; this.z = v.z; this.w = w; }
/// <summary> /// from-vector constructor (empty fields are zero/false) /// </summary> public bvec4(bvec3 v) { this.x = v.x; this.y = v.y; this.z = v.z; this.w = false; }
/// <summary> /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix. /// </summary> public bmat2x3(bvec3 c0, bvec3 c1) { this.m00 = c0.x; this.m01 = c0.y; this.m02 = c0.z; this.m10 = c1.x; this.m11 = c1.y; this.m12 = c1.z; }
/// <summary> /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix. /// </summary> public bmat2x4(bvec3 c0, bvec3 c1) { 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; }
/// <summary> /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix. /// </summary> public bmat3(bvec3 c0, bvec3 c1, bvec3 c2) { this.m00 = c0.x; this.m01 = c0.y; this.m02 = c0.z; this.m10 = c1.x; this.m11 = c1.y; this.m12 = c1.z; this.m20 = c2.x; this.m21 = c2.y; this.m22 = c2.z; }
/// <summary> /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix. /// </summary> public bmat3(bvec3 c0, bvec3 c1) { this.m00 = c0.x; this.m01 = c0.y; this.m02 = c0.z; this.m10 = c1.x; this.m11 = c1.y; this.m12 = c1.z; this.m20 = false; this.m21 = false; this.m22 = true; }
/// <summary> /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix. /// </summary> public bmat3x4(bvec3 c0, bvec3 c1, bvec3 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> /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix. /// </summary> public bmat4x3(bvec3 c0, bvec3 c1, bvec3 c2, bvec3 c3) { this.m00 = c0.x; this.m01 = c0.y; this.m02 = c0.z; this.m10 = c1.x; this.m11 = c1.y; this.m12 = c1.z; this.m20 = c2.x; this.m21 = c2.y; this.m22 = c2.z; this.m30 = c3.x; this.m31 = c3.y; this.m32 = c3.z; }
/// <summary> /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix. /// </summary> public bmat4x3(bvec3 c0, bvec3 c1, bvec3 c2) { this.m00 = c0.x; this.m01 = c0.y; this.m02 = c0.z; this.m10 = c1.x; this.m11 = c1.y; this.m12 = c1.z; this.m20 = c2.x; this.m21 = c2.y; this.m22 = c2.z; this.m30 = false; this.m31 = false; this.m32 = 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 bvec3 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 bvec3(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 bmat4(bvec3 c0, bvec3 c1, bvec3 c2, bvec3 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 bvec3 from component-wise application of Xnor (lhs == rhs). /// </summary> public static bvec3 Xnor(bvec3 lhs, bvec3 rhs) => new bvec3(lhs.x == rhs.x, lhs.y == rhs.y, lhs.z == rhs.z);
/// <summary> /// Returns a bvec3 from component-wise application of Xor (lhs != rhs). /// </summary> public static bvec3 Xor(bvec3 lhs, bool rhs) => new bvec3(lhs.x != rhs, lhs.y != rhs, lhs.z != rhs);
/// <summary> /// Returns a bvec3 from component-wise application of Xor (lhs != rhs). /// </summary> public static bvec3 Xor(bvec3 lhs, bvec3 rhs) => new bvec3(lhs.x != rhs.x, lhs.y != rhs.y, lhs.z != rhs.z);
/// <summary> /// from-vector constructor /// </summary> public bvec3(bvec3 v) { this.x = v.x; this.y = v.y; this.z = v.z; }
/// <summary> /// Returns a bvec3 from component-wise application of And (lhs && rhs). /// </summary> public static bvec3 And(bool lhs, bvec3 rhs) => new bvec3(lhs && rhs.x, lhs && rhs.y, lhs && rhs.z);
/// <summary> /// Returns a bvec3 from component-wise application of Or (lhs || rhs). /// </summary> public static bvec3 Or(bool lhs, bvec3 rhs) => new bvec3(lhs || rhs.x, lhs || rhs.y, lhs || rhs.z);
/// <summary> /// Returns a bvec3 from component-wise application of And (lhs && rhs). /// </summary> public static bvec3 And(bvec3 lhs, bvec3 rhs) => new bvec3(lhs.x && rhs.x, lhs.y && rhs.y, lhs.z && rhs.z);
/// <summary> /// Returns a bvec3 from component-wise application of Or (lhs || rhs). /// </summary> public static bvec3 Or(bvec3 lhs, bvec3 rhs) => new bvec3(lhs.x || rhs.x, lhs.y || rhs.y, lhs.z || rhs.z);
/// <summary> /// Returns a bvec3 from component-wise application of Nand (!(lhs && rhs)). /// </summary> public static bvec3 Nand(bool lhs, bvec3 rhs) => new bvec3(!(lhs && rhs.x), !(lhs && rhs.y), !(lhs && rhs.z));
/// <summary> /// Returns a bvec3 from component-wise application of Nand (!(lhs && rhs)). /// </summary> public static bvec3 Nand(bvec3 lhs, bool rhs) => new bvec3(!(lhs.x && rhs), !(lhs.y && rhs), !(lhs.z && rhs));
/// <summary> /// Returns a bvec3 from component-wise application of Nand (!(lhs && rhs)). /// </summary> public static bvec3 Nand(bvec3 lhs, bvec3 rhs) => new bvec3(!(lhs.x && rhs.x), !(lhs.y && rhs.y), !(lhs.z && rhs.z));
/// <summary> /// Returns a bvec3 from component-wise application of Xnor (lhs == rhs). /// </summary> public static bvec3 Xnor(bvec3 lhs, bool rhs) => new bvec3(lhs.x == rhs, lhs.y == rhs, lhs.z == rhs);
/// <summary> /// Returns a bvec3 from component-wise application of Xnor (lhs == rhs). /// </summary> public static bvec3 Xnor(bool lhs, bvec3 rhs) => new bvec3(lhs == rhs.x, lhs == rhs.y, lhs == rhs.z);
/// <summary> /// Returns a bvec3 from component-wise application of Nor (!(lhs || rhs)). /// </summary> public static bvec3 Nor(bvec3 lhs, bvec3 rhs) => new bvec3(!(lhs.x || rhs.x), !(lhs.y || rhs.y), !(lhs.z || rhs.z));
/// <summary> /// Returns a bvec3 from component-wise application of Nor (!(lhs || rhs)). /// </summary> public static bvec3 Nor(bvec3 lhs, bool rhs) => new bvec3(!(lhs.x || rhs), !(lhs.y || rhs), !(lhs.z || rhs));
/// <summary> /// Returns a bvec3 from component-wise application of Nor (!(lhs || rhs)). /// </summary> public static bvec3 Nor(bool lhs, bvec3 rhs) => new bvec3(!(lhs || rhs.x), !(lhs || rhs.y), !(lhs || rhs.z));
/// <summary> /// Returns a bvec3 from component-wise application of Or (lhs || rhs). /// </summary> public static bvec3 Or(bvec3 lhs, bool rhs) => new bvec3(lhs.x || rhs, lhs.y || rhs, lhs.z || rhs);
/// <summary> /// Returns a bvec3 from component-wise application of And (lhs && rhs). /// </summary> public static bvec3 And(bvec3 lhs, bool rhs) => new bvec3(lhs.x && rhs, lhs.y && rhs, lhs.z && rhs);