Exemplo n.º 1
0
 /// <summary>
 /// vector-and-scalar constructor (CAUTION: not angle-axis, use FromAngleAxis instead)
 /// </summary>
 public cquat(cvec3 v, Complex s)
 {
     this.x = v.x;
     this.y = v.y;
     this.z = v.z;
     this.w = s;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a vector rotated by the quaternion.
        /// </summary>
        public static cvec3 operator*(cquat q, cvec3 v)
        {
            var qv  = new cvec3(q.x, q.y, q.z);
            var uv  = cvec3.Cross(qv, v);
            var uuv = cvec3.Cross(qv, uv);

            return(v + ((uv * q.w) + uuv) * 2);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public cmat2x3(cvec3 c0, cvec3 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;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public cmat2x4(cvec3 c0, cvec3 c1)
 {
     this.m00 = c0.x;
     this.m01 = c0.y;
     this.m02 = c0.z;
     this.m03 = Complex.Zero;
     this.m10 = c1.x;
     this.m11 = c1.y;
     this.m12 = c1.z;
     this.m13 = Complex.Zero;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public cmat3(cvec3 c0, cvec3 c1, cvec3 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;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public cmat3(cvec3 c0, cvec3 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 = Complex.Zero;
     this.m21 = Complex.Zero;
     this.m22 = Complex.One;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public cmat4x3(cvec3 c0, cvec3 c1, cvec3 c2, cvec3 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;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public cmat3x4(cvec3 c0, cvec3 c1, cvec3 c2)
 {
     this.m00 = c0.x;
     this.m01 = c0.y;
     this.m02 = c0.z;
     this.m03 = Complex.Zero;
     this.m10 = c1.x;
     this.m11 = c1.y;
     this.m12 = c1.z;
     this.m13 = Complex.Zero;
     this.m20 = c2.x;
     this.m21 = c2.y;
     this.m22 = c2.z;
     this.m23 = Complex.Zero;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public cmat4x3(cvec3 c0, cvec3 c1, cvec3 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 = Complex.Zero;
     this.m31 = Complex.Zero;
     this.m32 = Complex.Zero;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Constructs this matrix from a series of column vectors. Non-overwritten fields are from an Identity matrix.
 /// </summary>
 public cmat4(cvec3 c0, cvec3 c1, cvec3 c2, cvec3 c3)
 {
     this.m00 = c0.x;
     this.m01 = c0.y;
     this.m02 = c0.z;
     this.m03 = Complex.Zero;
     this.m10 = c1.x;
     this.m11 = c1.y;
     this.m12 = c1.z;
     this.m13 = Complex.Zero;
     this.m20 = c2.x;
     this.m21 = c2.y;
     this.m22 = c2.z;
     this.m23 = Complex.Zero;
     this.m30 = c3.x;
     this.m31 = c3.y;
     this.m32 = c3.z;
     this.m33 = Complex.One;
 }
Exemplo n.º 11
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 cmat3x2 OuterProduct(cvec2 c, cvec3 r) => cvec2.OuterProduct(c, r);
Exemplo n.º 12
0
 /// <summary>
 /// Returns a bvec3 from component-wise application of Equal (lhs == rhs).
 /// </summary>
 public static bvec3 Equal(cvec3 lhs, cvec3 rhs) => cvec3.Equal(lhs, rhs);
Exemplo n.º 13
0
 /// <summary>
 /// Returns a bvec3 from component-wise application of NotEqual (lhs != rhs).
 /// </summary>
 public static bvec3 NotEqual(cvec3 lhs, cvec3 rhs) => cvec3.NotEqual(lhs, rhs);
Exemplo n.º 14
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 public static int GetHashCode(cvec3 v) => v.GetHashCode();
Exemplo n.º 15
0
 /// <summary>
 /// Returns true iff distance between lhs and rhs is less than or equal to epsilon
 /// </summary>
 public static bool ApproxEqual(cvec3 lhs, cvec3 rhs, double eps = 0.1d) => cvec3.ApproxEqual(lhs, rhs, eps);
Exemplo n.º 16
0
 /// <summary>
 /// Returns a vector containing component-wise real parts.
 /// </summary>
 public static dvec3 Real(cvec3 v) => v.Real;
Exemplo n.º 17
0
 /// <summary>
 /// Returns true iff this equals rhs type- and component-wise.
 /// </summary>
 public static bool Equals(cvec3 v, object obj) => v.Equals(obj);
Exemplo n.º 18
0
 /// <summary>
 /// Returns a copy of this vector with length one (returns zero if length is zero).
 /// </summary>
 public static cvec3 NormalizedSafe(cvec3 v) => v.NormalizedSafe;
Exemplo n.º 19
0
 /// <summary>
 /// Returns the number of components (3).
 /// </summary>
 public static int Count(cvec3 v) => v.Count;
Exemplo n.º 20
0
 /// <summary>
 /// Returns a vector containing component-wise phases.
 /// </summary>
 public static dvec3 Phase(cvec3 v) => v.Phase;
Exemplo n.º 21
0
 /// <summary>
 /// Returns a vector containing component-wise magnitudes.
 /// </summary>
 public static dvec3 Magnitude(cvec3 v) => v.Magnitude;
Exemplo n.º 22
0
 /// <summary>
 /// Calculate the reflection direction for an incident vector (N should be normalized in order to achieve the desired result).
 /// </summary>
 public static cvec3 Reflect(cvec3 I, cvec3 N) => cvec3.Reflect(I, N);
Exemplo n.º 23
0
 /// <summary>
 /// Returns the squared euclidean distance between the two vectors.
 /// </summary>
 public static double DistanceSqr(cvec3 lhs, cvec3 rhs) => cvec3.DistanceSqr(lhs, rhs);
Exemplo n.º 24
0
 /// <summary>
 /// Returns the inner product (dot product, scalar product) of the two vectors.
 /// </summary>
 public static Complex Dot(cvec3 lhs, cvec3 rhs) => cvec3.Dot(lhs, rhs);
Exemplo n.º 25
0
 /// <summary>
 /// Returns a copy of this vector with length one (undefined if this has zero length).
 /// </summary>
 public static cvec3 Normalized(cvec3 v) => v.Normalized;
Exemplo n.º 26
0
 /// <summary>
 /// Returns true iff this equals rhs component-wise.
 /// </summary>
 public static bool Equals(cvec3 v, cvec3 rhs) => v.Equals(rhs);
Exemplo n.º 27
0
 /// <summary>
 /// Returns the outer product (cross product, vector product) of the two vectors.
 /// </summary>
 public static cvec3 Cross(cvec3 l, cvec3 r) => cvec3.Cross(l, r);
Exemplo n.º 28
0
 /// <summary>
 /// Returns a vector containing component-wise imaginary parts.
 /// </summary>
 public static dvec3 Imaginary(cvec3 v) => v.Imaginary;
Exemplo n.º 29
0
 /// <summary>
 /// Returns a string representation of this vector using a provided seperator and a format for each component.
 /// </summary>
 public static string ToString(cvec3 v, string sep, string format) => v.ToString(sep, format);
Exemplo n.º 30
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(cvec3 v, string sep, string format, IFormatProvider provider) => v.ToString(sep, format, provider);