Math: Work around Windows math::is_negative build failures

Don't template size for matrix is_negative. These are causing random
build failures on the Windows buildbot.

Note that these already have the assumption of 3D coordinates baked
in. For 2D or 4D coordinates the implementation would have to be
different. So templating these for arbitrary dimensions does not
make much sense.

Pull Request: https://projects.blender.org/blender/blender/pulls/134137
This commit is contained in:
Brecht Van Lommel
2025-02-06 14:29:09 +01:00
committed by Brecht Van Lommel
parent 6cf73b052e
commit 7b3fa03e56
2 changed files with 10 additions and 6 deletions

View File

@@ -491,13 +491,10 @@ template<typename T>
/**
* Returns true if matrix has inverted handedness.
*
* \note It doesn't use determinant(mat4x4) as only the 3x3 components are needed
* when the matrix is used as a transformation to represent location/scale/rotation.
* \note It doesn't use determinant(mat4x4) as only the 3x3 components are needed assuming
* the matrix is used as a transformation to represent 3D location/scale/rotation.
*/
template<typename T, int Size> [[nodiscard]] bool is_negative(const MatBase<T, Size, Size> &mat)
{
return determinant(mat) < T(0);
}
template<typename T> [[nodiscard]] bool is_negative(const MatBase<T, 3, 3> &mat);
template<typename T> [[nodiscard]] bool is_negative(const MatBase<T, 4, 4> &mat);
/**

View File

@@ -139,13 +139,20 @@ template double determinant(const double2x2 &mat);
template double determinant(const double3x3 &mat);
template double determinant(const double4x4 &mat);
template<typename T> bool is_negative(const MatBase<T, 3, 3> &mat)
{
return determinant(mat) < T(0);
}
template<typename T> bool is_negative(const MatBase<T, 4, 4> &mat)
{
return Eigen::Map<const Eigen::Matrix<T, 3, 3>, 0, Eigen::Stride<4, 1>>(mat.base_ptr())
.determinant() < T(0);
}
template bool is_negative(const float3x3 &mat);
template bool is_negative(const float4x4 &mat);
template bool is_negative(const double3x3 &mat);
template bool is_negative(const double4x4 &mat);
/** \} */