/// <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; }
/// <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; }
/// <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; }
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()); }
/// <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; }
/// <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; }
/// <summary> /// Returns true iff this equals rhs type- and component-wise. /// </summary> public static bool Equals(cvec4 v, object obj) => v.Equals(obj);
/// <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);
/// <summary> /// Returns the squared euclidean distance between the two vectors. /// </summary> public static double DistanceSqr(cvec4 lhs, cvec4 rhs) => cvec4.DistanceSqr(lhs, rhs);
/// <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);
/// <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);
/// <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);
/// <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);
/// <summary> /// Returns true iff this equals rhs component-wise. /// </summary> public static bool Equals(cvec4 v, cvec4 rhs) => v.Equals(rhs);
/// <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; }
/// <summary> /// Returns the number of components (4). /// </summary> public static int Count(cvec4 v) => v.Count;
/// <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);
/// <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);
/// <summary> /// Returns a string representation of this vector using a provided seperator. /// </summary> public static string ToString(cvec4 v, string sep) => v.ToString(sep);
/// <summary> /// Returns a string representation of this vector using ', ' as a seperator. /// </summary> public static string ToString(cvec4 v) => v.ToString();
/// <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);
/// <summary> /// Returns a hash code for this instance. /// </summary> public static int GetHashCode(cvec4 v) => v.GetHashCode();
/// <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);
/// <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);
/// <summary> /// from-vector constructor (additional fields are truncated) /// </summary> public cvec2(cvec4 v) { this.x = v.x; this.y = v.y; }
/// <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);
/// <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);
/// <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);
/// <summary> /// Returns a dvec4 from component-wise application of Abs (v.Magnitude). /// </summary> public static dvec4 Abs(cvec4 v) => cvec4.Abs(v);
/// <summary> /// Returns a vector containing component-wise real parts. /// </summary> public static dvec4 Real(cvec4 v) => v.Real;