Vector.LengthSquared 属性

定义

获取此向量的长度的平方。

public:
 property double LengthSquared { double get(); };
public double LengthSquared { get; }
member this.LengthSquared : double
Public ReadOnly Property LengthSquared As Double

属性值

Double

此向量的 Length 的平方。

示例

以下示例演示如何使用此属性获取向量长度的平方。

private Double lengthSquaredExample()
{

    Vector vector1 = new Vector(20, 30); 

    // Gets the square of the length of a Vector. 
    // lengthSq is equal to 1300.
    Double lengthSqResult = vector1.LengthSquared;

    return lengthSqResult;
}
Private Function lengthSquaredExample() As Double

    Dim vector1 As New Vector(20, 30)

    ' Gets the square of the length of a Vector. 
    ' lengthSq is equal to 1300.
    Dim lengthSqResult As Double = vector1.LengthSquared

    Return lengthSqResult

End Function

注解

矢量的长度有时称为其数量级。

适用于