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其数量来规范化 。

适用于