Point3D.Equality(Point3D, Point3D) 运算符

定义

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

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

参数

point1
Point3D

要比较的第一个 Point3D 结构。

point2
Point3D

要比较的第二个 Point3D 结构。

返回

Boolean

如果 point1point2XYZ 坐标均相等,则为 true;否则为 false

示例

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

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

Point3D point1 = new Point3D(10, 5, 1);
Point3D point2 = new Point3D(15, 40, 60);
Boolean areEqual;

areEqual = (point1 == point2);
// areEqual is False

// Displaying Results
syntaxString = "areEqual = (point1 == point2);";
resultType = "Boolean";
operationString = "Checking if two 3D points are equal";
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
' Checks if two Point3Ds are equal using the overloaded equality operator.

Dim point1 As New Point3D(10, 5, 1)
Dim point2 As New Point3D(15, 40, 60)
Dim areEqual As Boolean

areEqual = (point1 = point2)
' areEqual is False

' Displaying Results
syntaxString = "areEqual = (point1 == point2)"
resultType = "Boolean"
operationString = "Checking if two 3D points are equal"
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString)

注解

Point3D如果两XY个结构的值相同,并且属性相同,则Z两个结构相等。

由于 Double 当对它们执行算术运算时,值可能会丢失精度,因此在逻辑上相等的两 Point3D 个实例之间的比较可能会失败。

适用于

另请参阅