Beispiel #1
0
 public override int GetHashCode()
 {
     return(M00.GetHashCode() ^ M01.GetHashCode() ^ M02.GetHashCode() ^ M03.GetHashCode() ^
            M10.GetHashCode() ^ M11.GetHashCode() ^ M12.GetHashCode() ^ M13.GetHashCode() ^
            M20.GetHashCode() ^ M21.GetHashCode() ^ M22.GetHashCode() ^ M23.GetHashCode() ^
            M30.GetHashCode() ^ M31.GetHashCode() ^ M32.GetHashCode() ^ M33.GetHashCode());
 }
Beispiel #2
0
 /// <summary>
 /// Returns the HashCode for this Matrix3D
 /// </summary>
 /// <returns>
 /// int - the HashCode for this Matrix3D
 /// </returns>
 public override int GetHashCode()
 {
     if (IsDistinguishedIdentity)
     {
         return(c_identityHashCode);
     }
     else
     {
         // Perform field-by-field XOR of HashCodes
         return(M11.GetHashCode() ^
                M12.GetHashCode() ^
                M13.GetHashCode() ^
                M14.GetHashCode() ^
                M21.GetHashCode() ^
                M22.GetHashCode() ^
                M23.GetHashCode() ^
                M24.GetHashCode() ^
                M31.GetHashCode() ^
                M32.GetHashCode() ^
                M33.GetHashCode() ^
                M34.GetHashCode() ^
                OffsetX.GetHashCode() ^
                OffsetY.GetHashCode() ^
                OffsetZ.GetHashCode() ^
                M44.GetHashCode());
     }
 }
 public override string ToString()
 {
     return(M00.ToString() + "," + M01.ToString() + "," + M02.ToString() + "," + M03.ToString() + "\r\n"
            + M10.ToString() + "," + M11.ToString() + "," + M12.ToString() + "," + M13.ToString() + "\r\n"
            + M20.ToString() + "," + M21.ToString() + "," + M22.ToString() + "," + M23.ToString() + "\r\n"
            + M30.ToString() + "," + M31.ToString() + "," + M32.ToString() + "," + M33.ToString());
 }
Beispiel #4
0
 /// <summary>Returns a string representation of the @this.</summary>
 /// <param name="format"></param>
 /// <param name="formatProvider"></param>
 /// <returns></returns>
 public string ToString(string format, IFormatProvider formatProvider)
 {
     return(string.Format(CultureInfo.CurrentCulture, "(({0},{1}), ({2},{3}), ({4},{5}), {6})",
                          M11.ToString(format, formatProvider), M12.ToString(format, formatProvider),
                          M21.ToString(format, formatProvider), M22.ToString(format, formatProvider),
                          M31.ToString(format, formatProvider), M32.ToString(format, formatProvider), M33.ToString(format, formatProvider)));
 }
Beispiel #5
0
        public override int GetHashCode()
        {
            // Overflow is fine, just wrap
            unchecked
            {
                int hash = 17;

                hash = hash * 29 + M00.GetHashCode();
                hash = hash * 29 + M01.GetHashCode();
                hash = hash * 29 + M02.GetHashCode();
                hash = hash * 29 + M03.GetHashCode();

                hash = hash * 29 + M10.GetHashCode();
                hash = hash * 29 + M11.GetHashCode();
                hash = hash * 29 + M12.GetHashCode();
                hash = hash * 29 + M13.GetHashCode();

                hash = hash * 29 + M20.GetHashCode();
                hash = hash * 29 + M21.GetHashCode();
                hash = hash * 29 + M22.GetHashCode();
                hash = hash * 29 + M23.GetHashCode();

                return(hash);
            }
        }
Beispiel #6
0
 /// <summary>
 /// Returns the hash code for this instance.
 /// </summary>
 /// <returns>A 32-bit signed integer that is the hash code for this instance.</returns>
 public override int GetHashCode()
 {
     return
         (M11.GetHashCode() ^ M12.GetHashCode() ^ M13.GetHashCode() ^
          M21.GetHashCode() ^ M22.GetHashCode() ^ M23.GetHashCode() ^
          M31.GetHashCode() ^ M32.GetHashCode() ^ M33.GetHashCode());
 }
 public override int GetHashCode()
 {
     return(HashCode.Combine(
                HashCode.Combine(M00.RoundToEpsilon(), M01.RoundToEpsilon(), M02.RoundToEpsilon()),
                HashCode.Combine(M10.RoundToEpsilon(), M11.RoundToEpsilon(), M12.RoundToEpsilon()),
                HashCode.Combine(M20.RoundToEpsilon(), M21.RoundToEpsilon(), M22.RoundToEpsilon())));
 }
Beispiel #8
0
 /// <summary>
 /// Gets the hash code for a given Matrix4.
 /// </summary>
 /// <returns>The calculated hash code.</returns>
 public override int GetHashCode()
 {
     // Note this method of hash code generation is similar to what the XNA framework does
     return(M11.GetHashCode() + M12.GetHashCode() + M13.GetHashCode() + M14.GetHashCode()
            + M21.GetHashCode() + M22.GetHashCode() + M23.GetHashCode() + M24.GetHashCode()
            + M31.GetHashCode() + M32.GetHashCode() + M33.GetHashCode() + M34.GetHashCode()
            + M41.GetHashCode() + M42.GetHashCode() + M43.GetHashCode() + M44.GetHashCode());
 }
Beispiel #9
0
 public string ToString(IFormatProvider formatProvider)
 {
     return(string.Format(formatProvider,
                          "[M11:{0} M12:{1} M13:{2}] [M21:{3} M22:{4} M23:{5}] [M31:{6} M32:{7} M33:{8}]",
                          M11.ToString(formatProvider), M12.ToString(formatProvider), M13.ToString(formatProvider),
                          M21.ToString(formatProvider), M22.ToString(formatProvider), M23.ToString(formatProvider),
                          M31.ToString(formatProvider), M32.ToString(formatProvider), M33.ToString(formatProvider)));
 }
Beispiel #10
0
        public override string ToString()
        {
            string str = "|" + M11.ToString() + ", " + M12.ToString() + ", " + DX.ToString() + "|" + Environment.NewLine +
                         "|" + M21.ToString() + ", " + M22.ToString() + ", " + DY.ToString() + "|" + Environment.NewLine +
                         "|0, 0, 1|";

            return(str);
        }
Beispiel #11
0
 public override int GetHashCode()
 {
     // Perform field-by-field XOR of HashCodes
     return(M11.GetHashCode() ^
            M12.GetHashCode() ^
            M21.GetHashCode() ^
            M22.GetHashCode() ^
            OffsetX.GetHashCode() ^
            OffsetY.GetHashCode());
 }
Beispiel #12
0
        public override int GetHashCode()
        {
            int h = M11.GetHashCode();

            h = (h << 5) - h + M21.GetHashCode();
            h = (h << 5) - h + M12.GetHashCode();
            h = (h << 5) - h + M22.GetHashCode();
            h = (h << 5) - h + OffsetX.GetHashCode();
            h = (h << 5) - h + OffsetY.GetHashCode();
            return(h);
        }
Beispiel #13
0
 public PxMatrix Resolve(IElement element, IFrameContext context)
 {
     return(new PxMatrix(
                M11.Resolve(element, context),
                M12.Resolve(element, context),
                M21.Resolve(element, context),
                M22.Resolve(element, context),
                M31.Resolve(element, context),
                M32.Resolve(element, context)
                ));
 }
Beispiel #14
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = M11.GetHashCode();
         hashCode = (hashCode * 397) ^ M12.GetHashCode();
         hashCode = (hashCode * 397) ^ M21.GetHashCode();
         hashCode = (hashCode * 397) ^ M22.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #15
0
 public void dump(string name = "")
 {
     DOut.pl(nameof(UMatrix4) + " " + name + " {");
     DOut.Indent++;
     DOut.pl(M11.ToString() + ", " + M12.ToString() + ", " + M13.ToString() + ", " + M14.ToString());
     DOut.pl(M21.ToString() + ", " + M22.ToString() + ", " + M23.ToString() + ", " + M24.ToString());
     DOut.pl(M31.ToString() + ", " + M32.ToString() + ", " + M33.ToString() + ", " + M34.ToString());
     DOut.pl(M41.ToString() + ", " + M42.ToString() + ", " + M43.ToString() + ", " + M44.ToString());
     DOut.Indent--;
     DOut.pl("}");
 }
Beispiel #16
0
        /// <summary>
        /// Returns a String representing this matrix instance.
        /// </summary>
        /// <returns>The string representation.</returns>
        public override string ToString()
        {
            var ci = System.Globalization.CultureInfo.CurrentCulture;

            return(string.Format(
                       ci,
                       "{{ {{M11:{0} M12:{1}}} {{M21:{2} M22:{3}}} {{M31:{4} M32:{5}}} }}",
                       M11.ToString(ci),
                       M12.ToString(ci),
                       M21.ToString(ci),
                       M22.ToString(ci),
                       M31.ToString(ci),
                       M32.ToString(ci)));
        }
        //// ===========================================================================================================
        //// Equality Members
        //// ===========================================================================================================

        public bool Equals(Matrix3x3 other)
        {
            return(M00.IsApproximatelyEqual(other.M00) &&
                   M01.IsApproximatelyEqual(other.M01) &&
                   M02.IsApproximatelyEqual(other.M02) &&

                   M10.IsApproximatelyEqual(other.M10) &&
                   M11.IsApproximatelyEqual(other.M11) &&
                   M12.IsApproximatelyEqual(other.M12) &&

                   M20.IsApproximatelyEqual(other.M20) &&
                   M21.IsApproximatelyEqual(other.M21) &&
                   M22.IsApproximatelyEqual(other.M22));
        }
Beispiel #18
0
        public string ToString(string format)
        {
            if (format == null)
            {
                return(ToString());
            }

            return(string.Format(format, CultureInfo.CurrentCulture,
                                 "[M11:{0} M12:{1} M13:{2}] [M21:{3} M22:{4} M23:{5}] [M31:{6} M32:{7} M33:{8}]",
                                 M11.ToString(format, CultureInfo.CurrentCulture), M12.ToString(format, CultureInfo.CurrentCulture),
                                 M13.ToString(format, CultureInfo.CurrentCulture),
                                 M21.ToString(format, CultureInfo.CurrentCulture), M22.ToString(format, CultureInfo.CurrentCulture),
                                 M23.ToString(format, CultureInfo.CurrentCulture),
                                 M31.ToString(format, CultureInfo.CurrentCulture), M32.ToString(format, CultureInfo.CurrentCulture),
                                 M33.ToString(format, CultureInfo.CurrentCulture)));
        }
Beispiel #19
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = M11.GetHashCode();
         hashCode = (hashCode * 397) ^ M12.GetHashCode();
         hashCode = (hashCode * 397) ^ M13.GetHashCode();
         hashCode = (hashCode * 397) ^ M21.GetHashCode();
         hashCode = (hashCode * 397) ^ M22.GetHashCode();
         hashCode = (hashCode * 397) ^ M23.GetHashCode();
         hashCode = (hashCode * 397) ^ M31.GetHashCode();
         hashCode = (hashCode * 397) ^ M32.GetHashCode();
         hashCode = (hashCode * 397) ^ M33.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #20
0
 public override string ToString()
 {
     if (IsIdentity)
     {
         return(this.GetType().Name + "=Identity");
     }
     else
     {
         return(string.Format(this.GetType().Name + "{{M11={0} M12={1} M21={2} M22={3} OffsetX={4} OffsetY={5}}}",
                              M11.ToString(CultureInfo.InvariantCulture),
                              M12.ToString(CultureInfo.InvariantCulture),
                              M21.ToString(CultureInfo.InvariantCulture),
                              M22.ToString(CultureInfo.InvariantCulture),
                              OffsetX.ToString(CultureInfo.InvariantCulture),
                              OffsetY.ToString(CultureInfo.InvariantCulture)));
     }
 }
Beispiel #21
0
 /// <summary>
 /// Compares two Matrix4 objects for equality.
 /// </summary>
 /// <param name="mat">The Matrix4 to compare.</param>
 /// <returns>Returns true if they are equal and false otherwise.</returns>
 public bool Equals(Matrix4 mat)
 {
     return(M11.Equals(mat.M11) &&
            M12.Equals(mat.M12) &&
            M13.Equals(mat.M13) &&
            M14.Equals(mat.M14) &&
            M21.Equals(mat.M21) &&
            M22.Equals(mat.M22) &&
            M23.Equals(mat.M23) &&
            M24.Equals(mat.M24) &&
            M31.Equals(mat.M31) &&
            M32.Equals(mat.M32) &&
            M33.Equals(mat.M33) &&
            M34.Equals(mat.M34) &&
            M41.Equals(mat.M41) &&
            M42.Equals(mat.M42) &&
            M43.Equals(mat.M43) &&
            M44.Equals(mat.M44));
 }
Beispiel #22
0
 public override int GetHashCode()
 {
     // Perform field-by-field XOR of HashCodes
     return(M11.GetHashCode() ^
            M12.GetHashCode() ^
            M13.GetHashCode() ^
            M14.GetHashCode() ^
            M21.GetHashCode() ^
            M22.GetHashCode() ^
            M23.GetHashCode() ^
            M24.GetHashCode() ^
            M31.GetHashCode() ^
            M32.GetHashCode() ^
            M33.GetHashCode() ^
            M34.GetHashCode() ^
            OffsetX.GetHashCode() ^
            OffsetY.GetHashCode() ^
            OffsetZ.GetHashCode() ^
            M44.GetHashCode());
 }
Beispiel #23
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 /// <returns>
 /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
 /// </returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = M11.GetHashCode();
         hashCode = (hashCode * 397) ^ M12.GetHashCode();
         hashCode = (hashCode * 397) ^ M13.GetHashCode();
         hashCode = (hashCode * 397) ^ M14.GetHashCode();
         hashCode = (hashCode * 397) ^ M21.GetHashCode();
         hashCode = (hashCode * 397) ^ M22.GetHashCode();
         hashCode = (hashCode * 397) ^ M23.GetHashCode();
         hashCode = (hashCode * 397) ^ M24.GetHashCode();
         hashCode = (hashCode * 397) ^ M31.GetHashCode();
         hashCode = (hashCode * 397) ^ M32.GetHashCode();
         hashCode = (hashCode * 397) ^ M33.GetHashCode();
         hashCode = (hashCode * 397) ^ M34.GetHashCode();
         hashCode = (hashCode * 397) ^ M41.GetHashCode();
         hashCode = (hashCode * 397) ^ M42.GetHashCode();
         hashCode = (hashCode * 397) ^ M43.GetHashCode();
         hashCode = (hashCode * 397) ^ M44.GetHashCode();
         return(hashCode);
     }
 }
        //// ===========================================================================================================
        //// Equality Members
        //// ===========================================================================================================

        public bool Equals(Matrix4x4 other)
        {
            // Check the diagonals first to see if we can exit early for identity matrix equality.
            return(M00.IsApproximatelyEqual(other.M00) &&
                   M11.IsApproximatelyEqual(other.M11) &&
                   M22.IsApproximatelyEqual(other.M22) &&
                   M33.IsApproximatelyEqual(other.M33) &&

                   M01.IsApproximatelyEqual(other.M01) &&
                   M02.IsApproximatelyEqual(other.M02) &&
                   M03.IsApproximatelyEqual(other.M03) &&

                   M10.IsApproximatelyEqual(other.M10) &&
                   M12.IsApproximatelyEqual(other.M12) &&
                   M13.IsApproximatelyEqual(other.M13) &&

                   M20.IsApproximatelyEqual(other.M20) &&
                   M21.IsApproximatelyEqual(other.M21) &&
                   M23.IsApproximatelyEqual(other.M23) &&

                   M30.IsApproximatelyEqual(other.M30) &&
                   M31.IsApproximatelyEqual(other.M31) &&
                   M32.IsApproximatelyEqual(other.M32));
        }
Beispiel #25
0
 /// <inheritdoc/>
 public override Int32 GetHashCode()
 {
     unchecked
     {
         var hash = 17;
         hash = hash * 23 + M11.GetHashCode();
         hash = hash * 23 + M12.GetHashCode();
         hash = hash * 23 + M13.GetHashCode();
         hash = hash * 23 + M14.GetHashCode();
         hash = hash * 23 + M21.GetHashCode();
         hash = hash * 23 + M22.GetHashCode();
         hash = hash * 23 + M23.GetHashCode();
         hash = hash * 23 + M24.GetHashCode();
         hash = hash * 23 + M31.GetHashCode();
         hash = hash * 23 + M32.GetHashCode();
         hash = hash * 23 + M33.GetHashCode();
         hash = hash * 23 + M34.GetHashCode();
         hash = hash * 23 + M41.GetHashCode();
         hash = hash * 23 + M42.GetHashCode();
         hash = hash * 23 + M43.GetHashCode();
         hash = hash * 23 + M44.GetHashCode();
         return(hash);
     }
 }
Beispiel #26
0
 public override int GetHashCode()
 {
     return(M11.GetHashCode() ^ M12.GetHashCode() ^
            M21.GetHashCode() ^ M22.GetHashCode() ^
            OffsetX.GetHashCode() ^ OffsetY.GetHashCode());
 }
Beispiel #27
0
 /// <summary>
 /// Returns the hash code for this instance.
 /// </summary>
 /// <returns>The hash code.</returns>
 public override int GetHashCode()
 {
     return(unchecked (M11.GetHashCode() + M12.GetHashCode() +
                       M21.GetHashCode() + M22.GetHashCode() +
                       M31.GetHashCode() + M32.GetHashCode()));
 }
Beispiel #28
0
 public bool Equals(Matrix3X3 other)
 {
     return(M11.Equals(other.M11) && M21.Equals(other.M21) && M31.Equals(other.M31) &&
            M12.Equals(other.M12) && M22.Equals(other.M22) && M32.Equals(other.M32) &&
            M13.Equals(other.M13) && M23.Equals(other.M23) && M33.Equals(other.M33));
 }
Beispiel #29
0
 public bool Equals(Matrix3x2 other)
 {
     return(M11.Equals(other.M11) && M12.Equals(other.M12) && M21.Equals(other.M21) && M22.Equals(other.M22) && M31.Equals(other.M31) && M32.Equals(other.M32));
 }
Beispiel #30
0
        //#endif

        #endregion

        #region IEquatable<Matrix4x4d> Members

        public bool Equals(Matrix4x4d other)
        {
            // Check reference first.
            if (object.ReferenceEquals(this, other))
            {
                return(true);
            }

            // Check for value equality.
            if (!M00.Equals(other.M00))
            {
                return(false);
            }
            if (!M10.Equals(other.M10))
            {
                return(false);
            }
            if (!M20.Equals(other.M20))
            {
                return(false);
            }
            if (!M30.Equals(other.M30))
            {
                return(false);
            }
            if (!M01.Equals(other.M01))
            {
                return(false);
            }
            if (!M11.Equals(other.M11))
            {
                return(false);
            }
            if (!M21.Equals(other.M21))
            {
                return(false);
            }
            if (!M31.Equals(other.M31))
            {
                return(false);
            }
            if (!M02.Equals(other.M02))
            {
                return(false);
            }
            if (!M12.Equals(other.M12))
            {
                return(false);
            }
            if (!M22.Equals(other.M22))
            {
                return(false);
            }
            if (!M32.Equals(other.M32))
            {
                return(false);
            }
            if (!M03.Equals(other.M03))
            {
                return(false);
            }
            if (!M13.Equals(other.M13))
            {
                return(false);
            }
            if (!M23.Equals(other.M23))
            {
                return(false);
            }
            if (!M33.Equals(other.M33))
            {
                return(false);
            }
            return(true);
        }