# Quaternion 結構

## 定義

``public value class Quaternion : IEquatable<System::Numerics::Quaternion>``
``public struct Quaternion : IEquatable<System.Numerics.Quaternion>``
``type Quaternion = struct``
``````Public Structure Quaternion
Implements IEquatable(Of Quaternion)``````

Quaternion

## 備註

@No__t-0 結構是用來以角度 theta 來有效率地將關於（x，y，z）向量的物件旋轉，其中：The Quaternion structure is used to efficiently rotate an object about the (x,y,z) vector by the angle theta, where:

``````w = cos(theta/2)
``````

## 建構函式

 從指定的元件建構四元數。Constructs a quaternion from the specified components. 從指定的向量和旋轉部分建立四元數。Creates a quaternion from the specified vector and rotation parts.

## 欄位

 四元數的旋轉元件。The rotation component of the quaternion. 四元數之向量元件的 X 值。The X value of the vector component of the quaternion. 四元數之向量元件的 Y 值。The Y value of the vector component of the quaternion. 四元數之向量元件的 Z 值。The Z value of the vector component of the quaternion.

## 屬性

 取得表示沒有旋轉的四元數。Gets a quaternion that represents no rotation. 取得值，這個值表示目前執行個體是否為單位四元數。Gets a value that indicates whether the current instance is the identity quaternion.

## 方法

 將一個四元數的每個元素和第二個四元數的相對應元素相加。Adds each element in one quaternion with its corresponding element in a second quaternion. 串連兩個四元數。Concatenates two quaternions. 傳回指定四元數的共軛。Returns the conjugate of a specified quaternion. 從單位向量和對此向量旋轉的角度建立四元數。Creates a quaternion from a unit vector and an angle to rotate around the vector. 從指定的旋轉矩陣建立四元數。Creates a quaternion from the specified rotation matrix. 依據指定的繞 Y 軸旋轉、繞 X 軸旋轉和滾動建立一個新四元數。Creates a new quaternion from the given yaw, pitch, and roll. 將一個四元數除以第二個四元數。Divides one quaternion by a second quaternion. 計算兩個四元數的內積。Calculates the dot product of two quaternions. 傳回值，這個值指出此執行個體和指定的物件是否相等。Returns a value that indicates whether this instance and a specified object are equal. 傳回值，這個值指出此執行個體和另一個四元數是否相等。Returns a value that indicates whether this instance and another quaternion are equal. 傳回這個執行個體的雜湊碼。Returns the hash code for this instance. 傳回反四元數。Returns the inverse of a quaternion. 計算此四元數的長度。Calculates the length of the quaternion. 計算此四元數的長度平方。Calculates the squared length of the quaternion. 根據指定第二個四元數之加權的值，執行兩個四元數之間的線性插補。Performs a linear interpolation between two quaternions based on a value that specifies the weighting of the second quaternion. 傳回將兩個四元數一起相乘所產生的四元數。Returns the quaternion that results from multiplying two quaternions together. 傳回四元數，該四元數為依據純量因數縮放指定四元數之所有元件而產生。Returns the quaternion that results from scaling all the components of a specified quaternion by a scalar factor. 將四元數的每個元件變換正負號。Reverses the sign of each component of the quaternion. 將指定的 Quaternion 之每個元件除以其長度。Divides each component of a specified Quaternion by its length. 使用球面線性插補，在兩個四元數間進行插補。Interpolates between two quaternions, using spherical linear interpolation. 將第二個四元數中的每個元素減去第一個四元數中相對應的元素。Subtracts each element in a second quaternion from its corresponding element in a first quaternion. 傳回表示這個四元數的字串。Returns a string that represents this quaternion.

## 運算子

 將一個四元數的每個元素和第二個四元數的相對應元素相加。Adds each element in one quaternion with its corresponding element in a second quaternion. 將一個四元數除以第二個四元數。Divides one quaternion by a second quaternion. 傳回值，指出兩個四元數是否相等。Returns a value that indicates whether two quaternions are equal. 傳回值，指出兩個四元數是否不相等。Returns a value that indicates whether two quaternions are not equal. 傳回將兩個四元數一起相乘所產生的四元數。Returns the quaternion that results from multiplying two quaternions together. 傳回四元數，該四元數為依據純量因數縮放指定四元數之所有元件而產生。Returns the quaternion that results from scaling all the components of a specified quaternion by a scalar factor. 將第二個四元數中的每個元素減去第一個四元數中相對應的元素。Subtracts each element in a second quaternion from its corresponding element in a first quaternion. 將四元數的每個元件變換正負號。Reverses the sign of each component of the quaternion.