Function directx_math::XMVectorTruncate[][src]

pub fn XMVectorTruncate(V: FXMVECTOR) -> XMVECTOR

Rounds each component of a vector to the nearest integer value in the direction of zero.

Parameters

V Vector whose components are to be truncated.

Return value

Returns a vector whose components are rounded to the nearest integer value in the direction of zero.

Remarks

The return value is computed based on the following logic, which preserves special values (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];

Reference

https://docs.microsoft.com/en-us/windows/win32/api/directxmath/nf-directxmath-XMVectorTruncate