第3.6節 轉換函數


我們總結了DirectX Math相關的轉換函數供參考。

// Constructs a scaling matrix:構造一個縮放矩陣:
XMMATRIX XM_CALLCONV XMMatrixScaling(float ScaleX,float ScaleY,float ScaleZ); // Scaling factors縮放因子
// Constructs a scaling matrix from components invector:從組件invector構造一個縮放矩陣:
XMMATRIX XM_CALLCONV XMMatrixScalingFromVector(FXMVECTOR Scale); // Scaling factors (sx, sy,sz)縮放因子向量
// Constructs a x-axis rotation matrix Rx:構造繞一個x軸旋轉矩陣Rx:
XMMATRIX XM_CALLCONV XMMatrixRotationX(float Angle); // Clockwise angle θ torotate順時針角度θ旋轉
// Constructs a y-axis rotation matrix Ry:構造繞一個y軸旋轉矩陣Rx:
XMMATRIX XM_CALLCONV XMMatrixRotationY(float Angle); // Clockwise angle θ torotate順時針角度θ旋轉
// Constructs a z-axis rotation matrix Rz:構造繞一個z軸旋轉矩陣Rx:
XMMATRIX XM_CALLCONV XMMatrixRotationZ(float Angle); // Clockwise angle θ torotate順時針角度θ旋轉
// Constructs an arbitrary axis rotation matrix Rn:構造繞任意軸旋轉矩陣Rn:
XMMATRIX XM_CALLCONV XMMatrixRotationAxis(
FXMVECTOR Axis, // Axis n to rotate about繞軸n旋轉
float Angle); // Clockwise angle θ to rotate順時針角度θ旋轉
Constructs a translation matrix:構造一個轉置矩陣:
XMMATRIX XM_CALLCONV XMMatrixTranslation(float OffsetX,float OffsetY,float OffsetZ); // Translation factors
Constructs a translation matrix from components in a vector:從矢量中的組件構造一個轉換矩陣:
XMMATRIX XM_CALLCONV XMMatrixTranslationFromVector(
FXMVECTOR Offset); // Translation factors (tx,ty, tz)
// Computes the vector-matrix product vM where vw = 1 for transforming points:計算矢量矩陣乘積vM,其中vw = 1用於變換點:
XMVECTOR XM_CALLCONV XMVector3TransformCoord(
FXMVECTOR V, // Input v
CXMMATRIX M); // Input M
// Computes the vector-matrix product vM where vw = 0 for transforming vectors:計算矢量矩陣乘積vM,其中vw = 0用於變換矢量:
XMVECTOR XM_CALLCONV XMVector3TransformNormal(
FXMVECTOR V, // Input v

CXMMATRIX M); // Input M

對於最後兩個函數XMVector3TransformCoord和XMVector3TransformNormal,您不需要明確設置w座標。 對於XMVector3TransformCoord和XMVector3TransformNormal,函數總是分別使用vw = 1和vw = 0。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章