Vector3D.UnaryNegation(Vector3D) 運算子

定義

Vector3D 結構加上負號。

C#
public static System.Windows.Media.Media3D.Vector3D operator -(System.Windows.Media.Media3D.Vector3D vector);

參數

vector
Vector3D

要加上負號的 Vector3D 結構。

傳回

Vector3D 結構,其 XYZ 值與 vectorXYZ 值正負號相反。

範例

下列範例示範如何使用多載負運算子來否定 Vector3D 結構。

C#
// Negates a Vector3D using the overloaded unary negation operator.

Vector3D vector1 = new Vector3D(20, 30, 40);
Vector3D vectorResult = new Vector3D();

vectorResult = -vector1;
// vectorResult is equal to (-20, -30, -40)

備註

傳回 Vector3D 的結構的大小與 () Lengthvector 相同,但其方向與 的 vector 相反。

適用於

產品 版本
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

另請參閱