XMVectorTruncate 函数 (directxmath.h)

将向量的每个分量舍入到以零方向最接近的整数值。

语法

XMVECTOR XM_CALLCONV XMVectorTruncate(
  [in] FXMVECTOR V
) noexcept;

参数

[in] V

要截断其组件的向量。

返回值

返回一个向量,其分量以零的方向舍入为最接近的整数值。

注解

返回值基于以下逻辑计算,该逻辑保留 INF、+INF、NaN、-NaN) (特殊值。


Result[0] = (fabsf(V[0]) < 8388608.0f) ? ((float)((int32_t)V[0])) : V[0];
Result[1] = (fabsf(V[1]) < 8388608.0f) ? ((float)((int32_t)V[1])) : V[1];
Result[2] = (fabsf(V[2]) < 8388608.0f) ? ((float)((int32_t)V[2])) : V[2];
Result[3] = (fabsf(V[3]) < 8388608.0f) ? ((float)((int32_t)V[3])) : V[3];
    

平台要求

Microsoft Visual Studio 2010 或 Microsoft Visual Studio 2012 与 Windows 8 Windows SDK。 支持 Win32 桌面应用、Windows 应用商店应用和 Windows Phone 8 应用。

要求

要求
目标平台 Windows
标头 directxmath.h (包括 DirectXMath.h)

另请参阅

向量算术函数