Vector3D.Normalize 方法

定義

將指定的 Vector3D 結構標準化。Normalizes the specified Vector3D structure.

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

範例

下列範例顯示如何Vector3D正規化結構。The following example shows how to normalize a Vector3D structure.

// 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會變成。A normalized Vector3D maintains its direction but its magnitude becomes 1. 產生Vector3D的通常稱為單位向量。The resulting Vector3D is often called a unit vector. 會藉由將Vector3D除以其大小來進行正規化。 Vector3DA Vector3D is normalized by dividing the Vector3D by its magnitude.

適用於