Прочетете на английски Редактиране

Споделяне чрез


Vector.Normalize Method

Definition

Normalizes this vector.

C#
public void Normalize();

Examples

The following example shows how to use this method to normalize a vector.

C#
private Vector normalizeExample()
{
    Vector vectorResult = new Vector(20, 30);

    // A normalized vector maintains its direction but 
    // its length becomes 1. 
    // vectorResult is approximately equal to (0.5547,0.8321).
    vectorResult.Normalize();

    return vectorResult;
}

Remarks

A normalized vector maintains its direction but its Length becomes 1. The resulting vector is often called a unit vector. A vector is normalized by dividing the vector by its own Length.

Applies to

Продукт Версии
.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