Vector3D.Equality(Vector3D, Vector3D) 操作员

定义

比较两个 Vector3D 结构是否相等。

public:
 static bool operator ==(System::Windows::Media::Media3D::Vector3D vector1, System::Windows::Media::Media3D::Vector3D vector2);
public static bool operator == (System.Windows.Media.Media3D.Vector3D vector1, System.Windows.Media.Media3D.Vector3D vector2);
static member ( = ) : System.Windows.Media.Media3D.Vector3D * System.Windows.Media.Media3D.Vector3D -> bool
Public Shared Operator == (vector1 As Vector3D, vector2 As Vector3D) As Boolean

参数

vector1
Vector3D

要比较的第一个 Vector3D 结构。

vector2
Vector3D

要比较的第二个 Vector3D 结构。

返回

如果 vector1vector2XYZ 分量相等,则为 true;否则为 false

示例

以下示例演示如何使用重载相等运算符检查两 Vector3D 个结构是否相等。

// Checks if two Vector3D structures are equal using the overloaded equality operator.

Vector3D vector1 = new Vector3D(20, 30, 40);
Vector3D vector2 = new Vector3D(45, 70, 80);
Boolean areEqual;

areEqual = (vector1 == vector2);
// areEqual is False
' Checks if two Vector3D structures are equal using the overloaded equality operator.

Dim vector1 As New Vector3D(20, 30, 40)
Dim vector2 As New Vector3D(45, 70, 80)
Dim areEqual As Boolean

areEqual = (vector1 = vector2)
' areEqual is False

注解

如果两个 Vector3D 结构的 XYZ 属性的值相同,则两个结构相等。

Vector3D 值是使用 值描述的 Double 。 由于 的值 Double 在操作时可能会失去精度,因此在逻辑上相等的两 Vector3D 个值之间的比较可能会失败。

适用于

另请参阅