예제 #1
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public cmat2x4(cvec4 c0, cvec4 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;
 }
예제 #2
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public cmat3x4(cvec4 c0, cvec4 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 = Complex.Zero;
     this.m21 = Complex.Zero;
     this.m22 = Complex.One;
     this.m23 = Complex.Zero;
 }
예제 #3
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public cmat3x4(cvec4 c0, cvec4 c1, cvec4 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;
 }
예제 #4
0
        static void Main(string[] args)
        {
            vec4 v  = new vec4();
            vec3 vv = v.swizzle.zxy;

            vv = vv.swizzle.bgr;
            ivec2 iv = (ivec2)v;

            iv += 2;
            iv /= 3;
            iv *= iv;
            iv  = 2 + iv;

            vec3 g = vec3.UnitY;

            g = g.Normalized * 3;

            cvec3 cg = g;

            Complex c = 1.0;
            // FIXME: Upcasting
            //vec2 fv = iv * 1f;
            //dvec2 dv = iv * 1.0;
            //dv += c.Imaginary;

            //cvec4 cv = v * c;
            //c.Magnitude
            cvec4 cv = cvec4.ImaginaryOnes;

            dvec4 acv = cvec4.Abs(cv);

            acv = dvec4.Tanh(acv);

            bvec2.Parse("true, false");

            double d;

            double.TryParse("1", out d);

            var gbvec  = new gvec4 <bool>(true, false, true, false);
            var gsvec  = new gvec3 <string>("", "", null);
            var gpvec  = new gvec2 <Program>(null, null);
            var gopvec = new gvec2 <Object>(null, null);
            var gtpvec = new gvec3 <Type>(typeof(int), 1.GetType(), "".GetType());
        }
예제 #5
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public cmat4(cvec4 c0, cvec4 c1, cvec4 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 = Complex.Zero;
     this.m31 = Complex.Zero;
     this.m32 = Complex.Zero;
     this.m33 = Complex.One;
 }
예제 #6
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public cmat4(cvec4 c0, cvec4 c1, cvec4 c2, cvec4 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;
 }
예제 #7
0
 /// <summary>
 /// Returns true iff this equals rhs type- and component-wise.
 /// </summary>
 public static bool Equals(cvec4 v, object obj) => v.Equals(obj);
예제 #8
0
 /// <summary>
 /// Returns the inner product (dot product, scalar product) of the two vectors.
 /// </summary>
 public static Complex Dot(cvec4 lhs, cvec4 rhs) => cvec4.Dot(lhs, rhs);
예제 #9
0
 /// <summary>
 /// Returns the squared euclidean distance between the two vectors.
 /// </summary>
 public static double DistanceSqr(cvec4 lhs, cvec4 rhs) => cvec4.DistanceSqr(lhs, rhs);
예제 #10
0
 /// <summary>
 /// OuterProduct treats the first parameter c as a column vector (matrix with one column) and the second parameter r as a row vector (matrix with one row) and does a linear algebraic matrix multiply c * r, yielding a matrix whose number of rows is the number of components in c and whose number of columns is the number of components in r.
 /// </summary>
 public static cmat4x3 OuterProduct(cvec3 c, cvec4 r) => cvec3.OuterProduct(c, r);
예제 #11
0
 /// <summary>
 /// Calculate the reflection direction for an incident vector (N should be normalized in order to achieve the desired result).
 /// </summary>
 public static cvec4 Reflect(cvec4 I, cvec4 N) => cvec4.Reflect(I, N);
예제 #12
0
 /// <summary>
 /// OuterProduct treats the first parameter c as a column vector (matrix with one column) and the second parameter r as a row vector (matrix with one row) and does a linear algebraic matrix multiply c * r, yielding a matrix whose number of rows is the number of components in c and whose number of columns is the number of components in r.
 /// </summary>
 public static cmat4x3 OuterProduct(cvec3 c, cvec4 r) => new cmat4x3(c.x * r.x, c.y * r.x, c.z * r.x, c.x * r.y, c.y * r.y, c.z * r.y, c.x * r.z, c.y * r.z, c.z * r.z, c.x * r.w, c.y * r.w, c.z * r.w);
예제 #13
0
 /// <summary>
 /// OuterProduct treats the first parameter c as a column vector (matrix with one column) and the second parameter r as a row vector (matrix with one row) and does a linear algebraic matrix multiply c * r, yielding a matrix whose number of rows is the number of components in c and whose number of columns is the number of components in r.
 /// </summary>
 public static cmat4x2 OuterProduct(cvec2 c, cvec4 r) => new cmat4x2(c.x * r.x, c.y * r.x, c.x * r.y, c.y * r.y, c.x * r.z, c.y * r.z, c.x * r.w, c.y * r.w);
예제 #14
0
 /// <summary>
 /// Returns true iff this equals rhs component-wise.
 /// </summary>
 public static bool Equals(cvec4 v, cvec4 rhs) => v.Equals(rhs);
예제 #15
0
 /// <summary>
 /// from-vector constructor (additional fields are truncated)
 /// </summary>
 public cvec3(cvec4 v)
 {
     this.x = v.x;
     this.y = v.y;
     this.z = v.z;
 }
예제 #16
0
 /// <summary>
 /// Returns the number of components (4).
 /// </summary>
 public static int Count(cvec4 v) => v.Count;
예제 #17
0
 /// <summary>
 /// Returns a string representation of this vector using a provided seperator and a format and format provider for each component.
 /// </summary>
 public static string ToString(cvec4 v, string sep, string format, IFormatProvider provider) => v.ToString(sep, format, provider);
예제 #18
0
 /// <summary>
 /// Returns a string representation of this vector using a provided seperator and a format for each component.
 /// </summary>
 public static string ToString(cvec4 v, string sep, string format) => v.ToString(sep, format);
예제 #19
0
 /// <summary>
 /// Returns a string representation of this vector using a provided seperator.
 /// </summary>
 public static string ToString(cvec4 v, string sep) => v.ToString(sep);
예제 #20
0
 /// <summary>
 /// Returns a string representation of this vector using ', ' as a seperator.
 /// </summary>
 public static string ToString(cvec4 v) => v.ToString();
예제 #21
0
 /// <summary>
 /// OuterProduct treats the first parameter c as a column vector (matrix with one column) and the second parameter r as a row vector (matrix with one row) and does a linear algebraic matrix multiply c * r, yielding a matrix whose number of rows is the number of components in c and whose number of columns is the number of components in r.
 /// </summary>
 public static cmat3x4 OuterProduct(cvec4 c, cvec3 r) => new cmat3x4(c.x * r.x, c.y * r.x, c.z * r.x, c.w * r.x, c.x * r.y, c.y * r.y, c.z * r.y, c.w * r.y, c.x * r.z, c.y * r.z, c.z * r.z, c.w * r.z);
예제 #22
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 public static int GetHashCode(cvec4 v) => v.GetHashCode();
예제 #23
0
 /// <summary>
 /// OuterProduct treats the first parameter c as a column vector (matrix with one column) and the second parameter r as a row vector (matrix with one row) and does a linear algebraic matrix multiply c * r, yielding a matrix whose number of rows is the number of components in c and whose number of columns is the number of components in r.
 /// </summary>
 public static cmat2x4 OuterProduct(cvec4 c, cvec2 r) => new cmat2x4(c.x * r.x, c.y * r.x, c.z * r.x, c.w * r.x, c.x * r.y, c.y * r.y, c.z * r.y, c.w * r.y);
예제 #24
0
 /// <summary>
 /// Returns true iff distance between lhs and rhs is less than or equal to epsilon
 /// </summary>
 public static bool ApproxEqual(cvec4 lhs, cvec4 rhs, double eps = 0.1d) => cvec4.ApproxEqual(lhs, rhs, eps);
예제 #25
0
 /// <summary>
 /// from-vector constructor (additional fields are truncated)
 /// </summary>
 public cvec2(cvec4 v)
 {
     this.x = v.x;
     this.y = v.y;
 }
예제 #26
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of Equal (lhs == rhs).
 /// </summary>
 public static bvec4 Equal(cvec4 lhs, cvec4 rhs) => cvec4.Equal(lhs, rhs);
예제 #27
0
 /// <summary>
 /// OuterProduct treats the first parameter c as a column vector (matrix with one column) and the second parameter r as a row vector (matrix with one row) and does a linear algebraic matrix multiply c * r, yielding a matrix whose number of rows is the number of components in c and whose number of columns is the number of components in r.
 /// </summary>
 public static cmat4x2 OuterProduct(cvec2 c, cvec4 r) => cvec2.OuterProduct(c, r);
예제 #28
0
 /// <summary>
 /// Returns a bvec4 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bvec4 NotEqual(cvec4 lhs, cvec4 rhs) => cvec4.NotEqual(lhs, rhs);
예제 #29
0
 /// <summary>
 /// Returns a dvec4 from component-wise application of Abs (v.Magnitude).
 /// </summary>
 public static dvec4 Abs(cvec4 v) => cvec4.Abs(v);
예제 #30
0
 /// <summary>
 /// Returns a vector containing component-wise real parts.
 /// </summary>
 public static dvec4 Real(cvec4 v) => v.Real;