Ejemplo 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;
 }
Ejemplo 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;
 }
Ejemplo 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;
 }
Ejemplo 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;
 }
Ejemplo 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;
 }
Ejemplo 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;
 }
Ejemplo 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;
 }
Ejemplo 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;
 }
Ejemplo 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;
 }
Ejemplo 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;
 }
Ejemplo 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);
        }
Ejemplo 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;
 }
Ejemplo 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);
Ejemplo 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);
Ejemplo 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);
Ejemplo n.º 16
0
 /// <summary>
 /// from-vector constructor
 /// </summary>
 public bvec3(bvec3 v)
 {
     this.x = v.x;
     this.y = v.y;
     this.z = v.z;
 }
Ejemplo 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);
Ejemplo 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);
Ejemplo 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);
Ejemplo 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);
Ejemplo 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));
Ejemplo 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));
Ejemplo 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));
Ejemplo 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);
Ejemplo 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);
Ejemplo 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));
Ejemplo 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));
Ejemplo 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));
Ejemplo 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);
Ejemplo 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);