Vector.LengthSquared 属性

定义

获取此向量的长度的平方。Gets the square of the length of this vector.

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

属性值

此向量的 Length 的平方。The square of the Length of this vector.

示例

下面的示例演示如何使用此属性来获取向量的长度的平方。The following example shows how to use this property to get the square of the length of a vector.

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

注解

矢量的长度有时也称为其量值。The length of a vector is sometimes referred to as its magnitude.

适用于