plumageRender/3rdparty/glm/gtx/matrix_cross_product.inl

38 lines
678 B
Plaintext
Raw Normal View History

2023-05-17 14:49:05 +08:00
/// @ref gtx_matrix_cross_product
namespace glm
{
2023-06-07 10:52:04 +08:00
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<3, 3, T, Q> matrixCross3
2023-05-17 14:49:05 +08:00
(
2023-06-07 10:52:04 +08:00
vec<3, T, Q> const& x
2023-05-17 14:49:05 +08:00
)
{
2023-06-07 10:52:04 +08:00
mat<3, 3, T, Q> Result(T(0));
2023-05-17 14:49:05 +08:00
Result[0][1] = x.z;
Result[1][0] = -x.z;
Result[0][2] = -x.y;
Result[2][0] = x.y;
Result[1][2] = x.x;
Result[2][1] = -x.x;
return Result;
}
2023-06-07 10:52:04 +08:00
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> matrixCross4
2023-05-17 14:49:05 +08:00
(
2023-06-07 10:52:04 +08:00
vec<3, T, Q> const& x
2023-05-17 14:49:05 +08:00
)
{
2023-06-07 10:52:04 +08:00
mat<4, 4, T, Q> Result(T(0));
2023-05-17 14:49:05 +08:00
Result[0][1] = x.z;
Result[1][0] = -x.z;
Result[0][2] = -x.y;
Result[2][0] = x.y;
Result[1][2] = x.x;
Result[2][1] = -x.x;
return Result;
}
}//namespace glm