Vector3D.Equality(Vector3D, Vector3D) 操作员
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
比较两个 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
和 vector2
的 X、Y 和 Z 分量相等,则为 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 结构的 X、Y 和 Z 属性的值相同,则两个结构相等。
Vector3D 值是使用 值描述的 Double 。 由于 的值 Double 在操作时可能会失去精度,因此在逻辑上相等的两 Vector3D 个值之间的比较可能会失败。