Click or drag to resize
AB4D logo

ExtensionsFastEquals Method

FastEquals compares two 4x4 matrices and returns true if they are exactly equal. To find results faster the FastEquals checks the fields that are usually different first (Offset, then scale, the others).

Namespace: Ab3d.DirectX
Assembly: Ab3d.DXEngine.Wpf (in Ab3d.DXEngine.Wpf.dll) Version: 7.0.8865.1045
Syntax
C#
public static bool FastEquals(
	this Matrix m1,
	ref Matrix m2
)

Parameters

m1  Matrix
first Matrix
m2  Matrix
second Matrix

Return Value

Boolean
true if the matrices are exactly equal

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Matrix. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks

FastEquals compares two 4x4 matrices and returns true if they are exactly equal.

This method is much faster then the standard SharpDX.Matrix.Equals method.

The first problem with harpDX.Matrix.Equals is that it uses IsSimilar (Abs(m1 - m2) < epsilon) that require many operations and casting to double.

The second thing is that the FastEquals fist compares the fields that are most likely to be different: first Offset, than scale and the other fields. Also M14, M24 and M34 are not compared because they do not play any role in standard matrix.

See Also