Esempio n. 1
0
 /// <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;
 }
Esempio n. 2
0
 /// <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;
 }
Esempio n. 3
0
 /// <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;
 }
Esempio n. 4
0
 /// <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;
 }
Esempio n. 5
0
 /// <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;
 }
Esempio n. 6
0
 /// <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;
 }
Esempio n. 7
0
 /// <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;
 }
Esempio n. 8
0
 /// <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;
 }
Esempio n. 9
0
 /// <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;
 }
Esempio n. 10
0
 /// <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;
 }
Esempio n. 11
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 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);
        }
Esempio n. 12
0
 /// <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;
 }
Esempio n. 13
0
 /// <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);
Esempio n. 14
0
 /// <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);
Esempio n. 15
0
 /// <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);
Esempio n. 16
0
 /// <summary>
 /// from-vector constructor
 /// </summary>
 public bvec3(bvec3 v)
 {
     this.x = v.x;
     this.y = v.y;
     this.z = v.z;
 }
Esempio n. 17
0
 /// <summary>
 /// Returns a bvec3 from component-wise application of And (lhs &amp;&amp; rhs).
 /// </summary>
 public static bvec3 And(bool lhs, bvec3 rhs) => new bvec3(lhs && rhs.x, lhs && rhs.y, lhs && rhs.z);
Esempio n. 18
0
 /// <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);
Esempio n. 19
0
 /// <summary>
 /// Returns a bvec3 from component-wise application of And (lhs &amp;&amp; rhs).
 /// </summary>
 public static bvec3 And(bvec3 lhs, bvec3 rhs) => new bvec3(lhs.x && rhs.x, lhs.y && rhs.y, lhs.z && rhs.z);
Esempio n. 20
0
 /// <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);
Esempio n. 21
0
 /// <summary>
 /// Returns a bvec3 from component-wise application of Nand (!(lhs &amp;&amp; rhs)).
 /// </summary>
 public static bvec3 Nand(bool lhs, bvec3 rhs) => new bvec3(!(lhs && rhs.x), !(lhs && rhs.y), !(lhs && rhs.z));
Esempio n. 22
0
 /// <summary>
 /// Returns a bvec3 from component-wise application of Nand (!(lhs &amp;&amp; rhs)).
 /// </summary>
 public static bvec3 Nand(bvec3 lhs, bool rhs) => new bvec3(!(lhs.x && rhs), !(lhs.y && rhs), !(lhs.z && rhs));
Esempio n. 23
0
 /// <summary>
 /// Returns a bvec3 from component-wise application of Nand (!(lhs &amp;&amp; rhs)).
 /// </summary>
 public static bvec3 Nand(bvec3 lhs, bvec3 rhs) => new bvec3(!(lhs.x && rhs.x), !(lhs.y && rhs.y), !(lhs.z && rhs.z));
Esempio n. 24
0
 /// <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);
Esempio n. 25
0
 /// <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);
Esempio n. 26
0
 /// <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));
Esempio n. 27
0
 /// <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));
Esempio n. 28
0
 /// <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));
Esempio n. 29
0
 /// <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);
Esempio n. 30
0
 /// <summary>
 /// Returns a bvec3 from component-wise application of And (lhs &amp;&amp; rhs).
 /// </summary>
 public static bvec3 And(bvec3 lhs, bool rhs) => new bvec3(lhs.x && rhs, lhs.y && rhs, lhs.z && rhs);