共用方式為


Vector3D.Normalize 方法

定義

正規化指定的 Vector3D 結構。

public:
 void Normalize();
public void Normalize ();
member this.Normalize : unit -> unit
Public Sub Normalize ()

範例

下列範例示範如何正規化 Vector3D 結構。

// Normalizes a Vector3D using the Normalize method.  
// Returns a Vector3D.

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

vector1.Normalize();
// vector1 is approximately equal to (0.37139, 0.55709, 0.74278)
' Normalizes a Vector3D using the Normalize method.  
' Returns a Vector3D.

Dim vector1 As New Vector3D(20, 30, 40)

vector1.Normalize()
' vector1 is approximately equal to (0.37139, 0.55709)

備註

正規化 Vector3D 會維持其方向,但其大小會變成 1 。 產生的 Vector3D 通常稱為單位向量。 正規 Vector3D 化的方式是將 除 Vector3D 以其大小。

適用於