27template<
typename T,
int Size>
28[[nodiscard]] MatBase<T, Size, Size>
invert(
const MatBase<T, Size, Size> &mat,
bool &r_success);
33template<
typename T,
int NumCol,
int NumRow>
34[[nodiscard]] MatBase<T, NumCol, NumRow>
transpose(
const MatBase<T, NumRow, NumCol> &mat);
39template<
typename T,
int NumCol,
int NumRow>
40[[nodiscard]] MatBase<T, NumCol, NumRow>
normalize(
const MatBase<T, NumCol, NumRow> &a);
46template<
typename T,
int NumCol,
int NumRow,
typename VectorT>
48 const MatBase<T, NumCol, NumRow> &a, VectorT &r_size);
54template<
typename T,
int Size> [[nodiscard]]
T determinant(
const MatBase<T, Size, Size> &mat);
59template<
typename T,
int Size>
60[[nodiscard]] MatBase<T, Size, Size>
adjoint(
const MatBase<T, Size, Size> &mat);
65template<
typename T,
int NumCol,
int NumRow,
typename VectorT>
66[[nodiscard]] MatBase<T, NumCol, NumRow>
translate(
const MatBase<T, NumCol, NumRow> &mat,
67 const VectorT &translation);
73template<
typename T,
int NumCol,
int NumRow,
typename RotationT>
75 const RotationT &rotation);
80template<
typename T,
int NumCol,
int NumRow,
typename VectorT>
82 const VectorT &
scale);
87template<
typename T,
int NumCol,
int NumRow>
168template<
typename T,
int Size>
181template<
typename MatT> [[nodiscard]] MatT
from_location(
const typename MatT::loc_type &location);
187template<
typename MatT,
int ScaleDim>
193template<
typename MatT,
typename RotationT>
199template<
typename MatT,
typename RotationT,
typename VectorT>
205template<
typename MatT,
typename RotationT>
206[[nodiscard]] MatT
from_loc_rot(
const typename MatT::loc_type &location,
207 const RotationT &rotation);
212template<
typename MatT,
int ScaleDim>
213[[nodiscard]] MatT
from_loc_scale(
const typename MatT::loc_type &location,
219template<
typename MatT,
typename RotationT,
int ScaleDim>
221 const RotationT &rotation,
235template<
typename MatT,
typename VectorT>
242template<
typename MatT,
typename VectorT>
244 const VectorT forward,
255template<
typename MatT,
typename VectorT> [[nodiscard]] MatT
from_up_axis(
const VectorT up);
266template<
typename MatT> [[nodiscard]] MatT
orthogonalize(
const MatT &mat,
const Axis axis);
273template<
typename MatT,
typename VectorT>
335template<
bool AllowNegativeScale = false,
typename T,
int NumCol,
int NumRow>
337template<
bool AllowNegativeScale = false,
typename T>
346template<
bool AllowNegativeScale = false,
typename T>
350template<
bool AllowNegativeScale = false,
typename T>
355template<
bool AllowNegativeScale = false,
typename T,
typename RotationT>
357 RotationT &r_rotation,
359template<
bool AllowNegativeScale = false,
typename T,
typename RotationT>
362 RotationT &r_rotation,
416template<
typename MatT,
typename VectorT>
422template<
typename MatT,
typename VectorT>
440 T left,
T right,
T bottom,
T top,
T near_clip,
T far_clip);
459 T left,
T right,
T bottom,
T top,
T near_clip,
T far_clip);
469 T angle_left,
T angle_right,
T angle_bottom,
T angle_top,
T near_clip,
T far_clip);
509template<
typename T,
int NumCol,
int NumRow>
512 const T epsilon =
T(0))
514 for (
int i = 0; i < NumCol; i++) {
515 for (
int j = 0; j < NumRow; j++) {
527template<
typename T,
int NumCol,
int NumRow>
530 for (
int i = 0; i < NumCol; i++) {
531 for (
int j = 0; j < NumRow; j++) {
532 if (mat[i][j] != (i != j ? 0.0f : 1.0f)) {
543template<
typename MatT> [[nodiscard]]
inline bool is_orthogonal(
const MatT &mat)
585 using T =
typename MatT::base_type;
593template<
typename T,
int NumCol,
int NumRow>
596 for (
int i = 0; i < NumCol; i++) {
613template<
typename T,
int NumCol,
int NumRow>
616template<
typename T,
int NumCol,
int NumRow>
619template<
typename T,
int NumCol,
int NumRow>
622template<
typename T,
int NumCol,
int NumRow>
625template<
typename T,
int NumCol,
int NumRow>
628template<
typename T,
int NumCol,
int NumRow>
631template<
typename T,
int NumCol,
int NumRow,
typename AngleT>
637template<
typename T,
int NumCol,
int NumRow>
640 for (
int i = 0; i < NumCol; i++) {
648template<
typename T,
int Size>
656template<
typename T,
int NumCol,
int NumRow>
664template<
typename T,
int NumCol,
int NumRow,
typename VectorT>
666 const VectorT &translation)
670 "Translation should be at least 1 column less than the matrix.");
671 constexpr int location_col = MatT::col_len - 1;
674 using IntermediateVecT =
675 VecBase<
typename MatT::base_type,
676 (MatT::row_len > MatT::col_len - 1) ? (MatT::col_len - 1) : MatT::row_len>;
680 *
reinterpret_cast<IntermediateVecT *
>(
681 &
result[location_col]) += translation[c] *
682 *
reinterpret_cast<const IntermediateVecT *
>(&mat[c]);
687template<
typename T,
int NumCol,
int NumRow,
typename AngleT>
692 using Vec3T =
typename MatT::vec3_type;
693 const T angle_sin =
sin(rotation.angle());
694 const T angle_cos =
cos(rotation.angle());
695 const Vec3T &axis_vec = rotation.axis();
699 if (axis_vec.x ==
T(1)) {
701 result[2][c] = -angle_sin * mat[1][c] + angle_cos * mat[2][c];
702 result[1][c] = angle_cos * mat[1][c] + angle_sin * mat[2][c];
705 else if (axis_vec.y ==
T(1)) {
707 result[0][c] = angle_cos * mat[0][c] - angle_sin * mat[2][c];
708 result[2][c] = angle_sin * mat[0][c] + angle_cos * mat[2][c];
711 else if (axis_vec.z ==
T(1)) {
713 result[0][c] = angle_cos * mat[0][c] + angle_sin * mat[1][c];
714 result[1][c] = -angle_sin * mat[0][c] + angle_cos * mat[1][c];
724template<
typename T,
int NumCol,
int NumRow,
typename VectorT>
726 const VectorT &
scale)
729 "Scale should be less or equal to the matrix in column count.");
735template<
typename T,
int NumCol,
int NumRow>
777 "r_size dimension should be equal to matrix column count.");
783template<
typename T,
int NumCol,
int NumRow>
791template<
typename T,
int NumCol,
int NumRow,
typename VectorT>
796 "r_size dimension should be equal to matrix column count.");
816 if (cy >
T(16) * std::numeric_limits<T>::epsilon()) {
837 const int i_index = eul1.
i_index();
838 const int j_index = eul1.
j_index();
839 const int k_index = eul1.
k_index();
841 const T cy =
math::hypot(mat[i_index][i_index], mat[i_index][j_index]);
842 if (cy >
T(16) * std::numeric_limits<T>::epsilon()) {
843 eul1.
i() =
math::atan2(mat[j_index][k_index], mat[k_index][k_index]);
845 eul1.
k() =
math::atan2(mat[i_index][j_index], mat[i_index][i_index]);
847 eul2.
i() =
math::atan2(-mat[j_index][k_index], -mat[k_index][k_index]);
849 eul2.
k() =
math::atan2(-mat[i_index][j_index], -mat[i_index][i_index]);
852 eul1.
i() =
math::atan2(-mat[k_index][j_index], mat[j_index][j_index]);
888 if (mat[2][2] < 0.0f) {
889 if (mat[0][0] > mat[1][1]) {
890 const T trace = 1.0f + mat[0][0] - mat[1][1] - mat[2][2];
892 if (mat[1][2] < mat[2][1]) {
898 q.
w = (mat[1][2] - mat[2][1]) * s;
899 q.
y = (mat[0][1] + mat[1][0]) * s;
900 q.
z = (mat[2][0] + mat[0][2]) * s;
901 if ((trace == 1.0f) && (q.
w == 0.0f && q.
y == 0.0f && q.
z == 0.0f)) [[unlikely]] {
907 const T trace = 1.0f - mat[0][0] + mat[1][1] - mat[2][2];
909 if (mat[2][0] < mat[0][2]) {
915 q.
w = (mat[2][0] - mat[0][2]) * s;
916 q.
x = (mat[0][1] + mat[1][0]) * s;
917 q.
z = (mat[1][2] + mat[2][1]) * s;
918 if ((trace == 1.0f) && (q.
w == 0.0f && q.
x == 0.0f && q.
z == 0.0f)) [[unlikely]] {
925 if (mat[0][0] < -mat[1][1]) {
926 const T trace = 1.0f - mat[0][0] - mat[1][1] + mat[2][2];
928 if (mat[0][1] < mat[1][0]) {
934 q.
w = (mat[0][1] - mat[1][0]) * s;
935 q.
x = (mat[2][0] + mat[0][2]) * s;
936 q.
y = (mat[1][2] + mat[2][1]) * s;
937 if ((trace == 1.0f) && (q.
w == 0.0f && q.
x == 0.0f && q.
y == 0.0f)) [[unlikely]] {
946 const T trace = 1.0f + mat[0][0] + mat[1][1] + mat[2][2];
950 q.
x = (mat[1][2] - mat[2][1]) * s;
951 q.
y = (mat[2][0] - mat[0][2]) * s;
952 q.
z = (mat[0][1] - mat[1][0]) * s;
953 if ((trace == 1.0f) && (q.
x == 0.0f && q.
y == 0.0f && q.
z == 0.0f)) [[unlikely]] {
966 const T q_len_squared = q.
x * q.
x + q.
y * q.
y + q.
z * q.
z + q.
w * q.
w;
967 const T threshold = 0.0002f ;
968 if (
math::abs(q_len_squared - 1.0f) >= threshold) {
969 const T q_len_inv = 1.0 /
math::sqrt(q_len_squared);
983 if (!std::isfinite(det)) [[unlikely]] {
986 if (det <
T(0)) [[unlikely]] {
996template<
typename T,
int NumCol,
int NumRow>
1001 const DoublePrecision cos_i =
math::cos(DoublePrecision(rotation.x().radian()));
1002 const DoublePrecision cos_j =
math::cos(DoublePrecision(rotation.y().radian()));
1003 const DoublePrecision cos_k =
math::cos(DoublePrecision(rotation.z().radian()));
1004 const DoublePrecision sin_i =
math::sin(DoublePrecision(rotation.x().radian()));
1005 const DoublePrecision sin_j =
math::sin(DoublePrecision(rotation.y().radian()));
1006 const DoublePrecision sin_k =
math::sin(DoublePrecision(rotation.z().radian()));
1007 const DoublePrecision cos_i_cos_k = cos_i * cos_k;
1008 const DoublePrecision cos_i_sin_k = cos_i * sin_k;
1009 const DoublePrecision sin_i_cos_k = sin_i * cos_k;
1010 const DoublePrecision sin_i_sin_k = sin_i * sin_k;
1012 MatT mat = MatT::identity();
1013 mat[0][0] =
T(cos_j * cos_k);
1014 mat[1][0] =
T(sin_j * sin_i_cos_k - cos_i_sin_k);
1015 mat[2][0] =
T(sin_j * cos_i_cos_k + sin_i_sin_k);
1017 mat[0][1] =
T(cos_j * sin_k);
1018 mat[1][1] =
T(sin_j * sin_i_sin_k + cos_i_cos_k);
1019 mat[2][1] =
T(sin_j * cos_i_sin_k - sin_i_cos_k);
1021 mat[0][2] =
T(-sin_j);
1022 mat[1][2] =
T(cos_j * sin_i);
1023 mat[2][2] =
T(cos_j * cos_i);
1027template<
typename T,
int NumCol,
int NumRow>
1031 const int i_index = rotation.i_index();
1032 const int j_index = rotation.j_index();
1033 const int k_index = rotation.k_index();
1037 MatT
result = MatT::identity();
1038 result[i_index][i_index] = mat[0][0];
1039 result[j_index][i_index] = mat[1][0];
1040 result[k_index][i_index] = mat[2][0];
1041 result[i_index][j_index] = mat[0][1];
1042 result[j_index][j_index] = mat[1][1];
1043 result[k_index][j_index] = mat[2][1];
1044 result[i_index][k_index] = mat[0][2];
1045 result[j_index][k_index] = mat[1][2];
1046 result[k_index][k_index] = mat[2][2];
1053template<
typename T,
int NumCol,
int NumRow>
1058 const DoublePrecision q0 = std::numbers::sqrt2 * DoublePrecision(rotation.w);
1059 const DoublePrecision q1 = std::numbers::sqrt2 * DoublePrecision(rotation.x);
1060 const DoublePrecision q2 = std::numbers::sqrt2 * DoublePrecision(rotation.y);
1061 const DoublePrecision q3 = std::numbers::sqrt2 * DoublePrecision(rotation.z);
1063 const DoublePrecision qda = q0 * q1;
1064 const DoublePrecision qdb = q0 * q2;
1065 const DoublePrecision qdc = q0 * q3;
1066 const DoublePrecision qaa = q1 * q1;
1067 const DoublePrecision qab = q1 * q2;
1068 const DoublePrecision qac = q1 * q3;
1069 const DoublePrecision qbb = q2 * q2;
1070 const DoublePrecision qbc = q2 * q3;
1071 const DoublePrecision qcc = q3 * q3;
1073 MatT mat = MatT::identity();
1074 mat[0][0] =
T(1.0 - qbb - qcc);
1075 mat[0][1] =
T(qdc + qab);
1076 mat[0][2] =
T(-qdb + qac);
1078 mat[1][0] =
T(-qdc + qab);
1079 mat[1][1] =
T(1.0 - qaa - qcc);
1080 mat[1][2] =
T(qda + qbc);
1082 mat[2][0] =
T(qdb + qac);
1083 mat[2][1] =
T(-qda + qbc);
1084 mat[2][2] =
T(1.0 - qaa - qbb);
1089template<
typename T,
int NumCol,
int NumRow>
1103 const T &w0 = c0.
w, &x0 = c0.
x, &y0 = c0.
y, &z0 = c0.
z;
1104 const T &we = ce.
w, &xe = ce.
x, &ye = ce.
y, &ze = ce.
z;
1108 mat[3][0] =
T(2) * (-we * x0 + xe * w0 - ye * z0 + ze * y0);
1109 mat[3][1] =
T(2) * (-we * y0 + xe * z0 + ye * w0 - ze * x0);
1110 mat[3][2] =
T(2) * (-we * z0 - xe * y0 + ye * x0 + ze * w0);
1112 if (rotation.scale_weight !=
T(0)) {
1113 mat.template view<4, 4>() = mat * rotation.scale;
1118template<
typename T,
int NumCol,
int NumRow>
1122 MatT mat = MatT::identity();
1129template<
typename T,
int NumCol,
int NumRow,
typename AngleT>
1133 using Vec3T =
typename MatT::vec3_type;
1134 const T angle_sin =
sin(rotation.angle());
1135 const T angle_cos =
cos(rotation.angle());
1136 const Vec3T &axis = rotation.axis();
1140 T ico = (
T(1) - angle_cos);
1141 Vec3T nsi = axis * angle_sin;
1143 Vec3T n012 = (axis * axis) * ico;
1144 T n_01 = (axis[0] * axis[1]) * ico;
1145 T n_02 = (axis[0] * axis[2]) * ico;
1146 T n_12 = (axis[1] * axis[2]) * ico;
1149 mat[0][1] = n_01 + nsi[2];
1150 mat[0][2] = n_02 - nsi[1];
1151 mat[1][0] = n_01 - nsi[2];
1152 mat[1][2] = n_12 + nsi[0];
1153 mat[2][0] = n_02 + nsi[1];
1154 mat[2][1] = n_12 - nsi[0];
1158template<
typename T,
int NumCol,
int NumRow>
1162 const T cos_i =
cos(rotation);
1163 const T sin_i =
sin(rotation);
1165 MatT mat = MatT::identity();
1233 eul1 = eul1.wrapped_around(reference);
1299template<
bool AllowNegativeScale,
typename T,
int NumCol,
int NumRow>
1303 if constexpr (AllowNegativeScale) {
1311template<
bool AllowNegativeScale,
typename T>
1315 if constexpr (AllowNegativeScale) {
1352template<
bool AllowNegativeScale,
typename T>
1358 if constexpr (AllowNegativeScale) {
1360 normalized_mat = -normalized_mat;
1367template<
bool AllowNegativeScale,
typename T>
1377template<
bool AllowNegativeScale,
typename T,
typename RotationT>
1379 RotationT &r_rotation,
1383 if constexpr (AllowNegativeScale) {
1385 normalized_mat = -normalized_mat;
1392template<
bool AllowNegativeScale,
typename T,
typename RotationT>
1395 RotationT &r_rotation,
1406template<
bool AllowNegativeScale,
typename T,
typename RotationT>
1409 RotationT &r_rotation,
1418 r_rotation = RotationT(euler_rotation);
1422template<
typename MatT> [[nodiscard]] MatT
from_location(
const typename MatT::loc_type &location)
1424 MatT mat = MatT::identity();
1425 mat.location() = location;
1429template<
typename MatT,
int ScaleDim>
1433 "Scale dimension should fit the matrix diagonal length.");
1436 [&](
auto i) {
result[i][i] = (i < ScaleDim) ?
scale[i] :
typename MatT::base_type(1); });
1440template<
typename MatT,
typename RotationT>
1446template<
typename MatT,
typename RotationT,
typename VectorT>
1452template<
typename MatT,
typename RotationT,
int ScaleDim>
1454 const RotationT &rotation,
1460 mat.location() = location;
1464template<
typename MatT,
typename RotationT>
1465[[nodiscard]] MatT
from_loc_rot(
const typename MatT::loc_type &location,
const RotationT &rotation)
1470 mat.location() = location;
1474template<
typename MatT,
int ScaleDim>
1479 mat.location() = location;
1490template<
typename MatT,
typename VectorT>
1498 matrix.x_axis() = forward;
1502 matrix.z_axis() = up;
1506template<
typename MatT,
typename VectorT>
1508 const VectorT forward,
1513 matrix.location() = location;
1517template<
typename MatT,
typename VectorT> [[nodiscard]] MatT
from_up_axis(
const VectorT up)
1520 using T =
typename MatT::base_type;
1523 T sign = up.z >=
T(0) ?
T(1) :
T(-1);
1524 T a =
T(-1) / (
sign + up.z);
1525 T b = up.x * up.y * a;
1536 using T =
typename MatT::base_type;
1572 if (
dot(
R.x,
R.y) <
T(1)) {
1576 else if (
dot(
R.x,
R.z) <
T(1)) {
1586 if (
dot(
R.y,
R.x) <
T(1)) {
1591 else if (
dot(
R.x,
R.z) <
T(1)) {
1601 if (
dot(
R.z,
R.x) <
T(1)) {
1605 else if (
dot(
R.z,
R.y) <
T(1)) {
1624 result.location() = mat.location();
1628template<
typename MatT,
typename VectorT>
1643 return mat.template view<2, 2>() * point + mat.
location();
1655 return mat.template view<3, 3>() * point + mat.
location();
1661 return mat * direction;
1667 return mat.template view<3, 3>() * direction;
1679 const T x = direction[0];
1680 const T y = direction[1];
1681 const T z = direction[2];
1683 return {
x * mat[0][0] +
y * mat[0][1] +
z * mat[0][2],
1684 x * mat[1][0] +
y * mat[1][1] +
z * mat[1][2],
1685 x * mat[2][0] +
y * mat[2][1] +
z * mat[2][2]};
1692 const T x = direction[0];
1693 const T y = direction[1];
1694 const T z = direction[2];
1696 return {
x * mat[0][0] +
y * mat[0][1] +
z * mat[0][2],
1697 x * mat[1][0] +
y * mat[1][1] +
z * mat[1][2],
1698 x * mat[2][0] +
y * mat[2][1] +
z * mat[2][2]};
1701template<
typename T,
int N,
int NumRow>
1710template<
typename T,
int N,
int NumRow>
1733 const T x_delta = right - left;
1734 const T y_delta = top - bottom;
1735 const T z_delta = far_clip - near_clip;
1738 if (x_delta != 0 && y_delta != 0 && z_delta != 0) {
1739 mat[0][0] =
T(2.0) / x_delta;
1740 mat[3][0] = -(right + left) / x_delta;
1741 mat[1][1] =
T(2.0) / y_delta;
1742 mat[3][1] = -(top + bottom) / y_delta;
1743 mat[2][2] = -
T(2.0) / z_delta;
1744 mat[3][2] = -(far_clip + near_clip) / z_delta;
1752 const T x_delta = right - left;
1753 const T y_delta = top - bottom;
1756 if (x_delta != 0 && y_delta != 0) {
1757 mat[0][0] =
T(2.0) / x_delta;
1758 mat[3][0] = -(right + left) / x_delta;
1759 mat[1][1] =
T(2.0) / y_delta;
1760 mat[3][1] = -(top + bottom) / y_delta;
1762 constexpr float eps = 2.4e-7f;
1767 mat[3][2] = -1.0f -
eps * near_clip;
1775 const T x_delta = right - left;
1776 const T y_delta = top - bottom;
1777 const T z_delta = far_clip - near_clip;
1780 if (x_delta != 0 && y_delta != 0 && z_delta != 0) {
1781 mat[0][0] = near_clip *
T(2.0) / x_delta;
1782 mat[1][1] = near_clip *
T(2.0) / y_delta;
1783 mat[2][0] = (right + left) / x_delta;
1784 mat[2][1] = (top + bottom) / y_delta;
1785 mat[2][2] = -(far_clip + near_clip) / z_delta;
1787 mat[3][2] = (-2.0f * near_clip * far_clip) / z_delta;
1796 const T x_delta = right - left;
1797 const T y_delta = top - bottom;
1801 if (x_delta != 0 && y_delta != 0) {
1802 mat[0][0] = near_clip *
T(2.0) / x_delta;
1803 mat[1][1] = near_clip *
T(2.0) / y_delta;
1804 mat[2][0] = (right + left) / x_delta;
1805 mat[2][1] = (top + bottom) / y_delta;
1807 constexpr float eps = 2.4e-7f;
1809 mat[2][3] = (
eps - 1.0f);
1810 mat[3][2] = (
eps - 2.0f) * near_clip;
1818 T angle_left,
T angle_right,
T angle_bottom,
T angle_top,
T near_clip,
T far_clip)
1826 mat[0][0] /= near_clip;
1827 mat[1][1] /= near_clip;
1835 const bool is_perspective = mat[2][3] == -1.0f;
1836 const bool is_perspective_infinite = mat[2][2] == -1.0f;
1837 if (is_perspective || is_perspective_infinite) {
1842 result[3][0] += offset.x;
1843 result[3][1] += offset.y;
1849 float left,
float right,
float bottom,
float top,
float near_clip,
float far_clip);
1851 float left,
float right,
float bottom,
float top,
float near_clip,
float far_clip);
1867 bool use_threading =
true);
1871 bool use_threading =
true);
#define BLI_assert_unreachable()
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
QuaternionBase< T > normalized_to_quat_with_checks(const MatBase< T, 3, 3 > &mat)
void normalized_to_eul2(const MatBase< T, 3, 3 > &mat, EulerXYZBase< T > &eul1, EulerXYZBase< T > &eul2)
void to_rotation(const MatBase< T, 2, 2 > &mat, AngleRadianBase< T > &r_rotation)
QuaternionBase< T > normalized_to_quat_fast(const MatBase< T, 3, 3 > &mat)
AngleRadianBase< T > normalized_to_angle(const MatBase< T, 2, 2 > &mat)
MatBase< T, NumCol, NumRow > from_rotation(const AngleRadianBase< T > &rotation)
MatBase< T, 4, 4 > orthographic(T left, T right, T bottom, T top, T near_clip, T far_clip)
Create an orthographic projection matrix using OpenGL coordinate convention: Maps each axis range to ...
MatBase< T, 4, 4 > orthographic_infinite(T left, T right, T bottom, T top)
Create an orthographic projection matrix using OpenGL coordinate convention: Maps each axis range to ...
MatBase< T, 4, 4 > perspective_fov(T angle_left, T angle_right, T angle_bottom, T angle_top, T near_clip, T far_clip)
Create a perspective projection matrix using OpenGL coordinate convention: Maps each axis range to [-...
MatBase< T, 4, 4 > translate(const MatBase< T, 4, 4 > &mat, const VecBase< T, 2 > &offset)
Translate a projection matrix after creation in the screen plane. Usually used for anti-aliasing jitt...
MatBase< T, 4, 4 > perspective_infinite(T left, T right, T bottom, T top, T near_clip)
Create a perspective projection matrix using OpenGL coordinate convention: Maps each axis range to [-...
MatBase< T, 4, 4 > perspective(T left, T right, T bottom, T top, T near_clip, T far_clip)
Create a perspective projection matrix using OpenGL coordinate convention: Maps each axis range to [-...
MatBase< T, Size, Size > adjoint(const MatBase< T, Size, Size > &mat)
AngleRadianBase< float > AngleRadian
AngleRadianBase< T > to_angle(const MatBase< T, 2, 2 > &mat)
QuaternionBase< float > Quaternion
T length_squared(const VecBase< T, Size > &a)
T cos(const AngleRadianBase< T > &a)
MatBase< T, NumCol, NumRow > transpose(const MatBase< T, NumRow, NumCol > &mat)
VectorT project_point_safe(const MatT &mat, const VectorT &point)
VecBase< T, 3 > transform_direction_transposed(const MatBase< T, 3, 3 > &mat, const VecBase< T, 3 > &direction)
bool is_normalized(const DualQuaternionBase< T > &dq)
QuaternionBase< T > to_quaternion(const AxisAngleBase< T, AngleT > &axis_angle)
T safe_divide(const T &a, const T &b)
bool is_negative(const MatBase< T, 3, 3 > &mat)
MatBase< T, NumCol, NumRow > scale(const MatBase< T, NumCol, NumRow > &mat, const VectorT &scale)
bool is_orthonormal(const MatT &mat)
Quaternion to_quaternion_legacy(const float3x3 &mat)
MatT from_up_axis(const VectorT up)
T to_vector(const Axis axis)
T length(const VecBase< T, Size > &a)
MatT from_loc_rot(const typename MatT::loc_type &location, const RotationT &rotation)
MatT from_loc_scale(const typename MatT::loc_type &location, const VecBase< typename MatT::base_type, ScaleDim > &scale)
AxisAngleBase< float, AngleRadianBase< float > > AxisAngle
bool is_uniformly_scaled(const MatT &mat)
QuaternionBase< T > normalize_and_get_length(const QuaternionBase< T > &q, T &out_length)
bool is_unit_scale(const MatBase< T, NumCol, NumRow > &m)
MatBase< T, Size, Size > pseudo_invert(const MatBase< T, Size, Size > &mat, T epsilon=1e-8)
T length_manhattan(const VecBase< T, Size > &a)
EulerXYZBase< float > EulerXYZ
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
CartesianBasis invert(const CartesianBasis &basis)
AxisSigned cross(const AxisSigned a, const AxisSigned b)
VectorT project_point(const MatT &mat, const VectorT &point)
MatT from_scale(const VecBase< typename MatT::base_type, ScaleDim > &scale)
T interpolate(const T &a, const T &b, const FactorT &t)
void transform_normals(const float3x3 &transform, MutableSpan< float3 > normals)
EulerXYZBase< T > to_nearest_euler(const MatBase< T, 3, 3 > &mat, const EulerXYZBase< T > &reference)
MatBase< T, 2, 2 > from_direction(const VecBase< T, 2 > &direction)
T atan2(const T &y, const T &x)
MatBase< T, 3, 3 > interpolate_fast(const MatBase< T, 3, 3 > &a, const MatBase< T, 3, 3 > &b, T t)
MatBase< T, NumCol, NumRow > translate(const MatBase< T, NumCol, NumRow > &mat, const VectorT &translation)
QuaternionBase< T > normalized_to_quaternion_safe(const MatBase< T, 3, 3 > &mat)
MatBase< T, NumCol, NumRow > normalize_and_get_size(const MatBase< T, NumCol, NumRow > &a, VectorT &r_size)
MatT from_origin_transform(const MatT &transform, const VectorT origin)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
VecBase< T, 3 > to_scale(const MatBase< T, NumCol, NumRow > &mat)
AxisAngleBase< float, AngleCartesianBase< float > > AxisAngleCartesian
bool is_equal(const MatBase< T, NumCol, NumRow > &a, const MatBase< T, NumCol, NumRow > &b, const T epsilon=T(0))
T sin(const AngleRadianBase< T > &a)
void to_rot_scale(const MatBase< T, 2, 2 > &mat, AngleRadianBase< T > &r_rotation, VecBase< T, 2 > &r_scale)
MatT orthogonalize(const MatT &mat, const Axis axis)
Euler3Base< float > Euler3
bool is_identity(const MatBase< T, NumCol, NumRow > &mat)
MatBase< T, NumCol, NumRow > interpolate_linear(const MatBase< T, NumCol, NumRow > &a, const MatBase< T, NumCol, NumRow > &b, T t)
T tan(const AngleRadianBase< T > &a)
void to_loc_rot_scale_safe(const MatBase< T, 4, 4 > &mat, VecBase< T, 3 > &r_location, RotationT &r_rotation, VecBase< T, 3 > &r_scale)
MatT from_location(const typename MatT::loc_type &location)
void to_loc_rot_scale(const MatBase< T, 3, 3 > &mat, VecBase< T, 2 > &r_location, AngleRadianBase< T > &r_rotation, VecBase< T, 2 > &r_scale)
VecBase< T, 3 > transform_direction(const MatBase< T, 3, 3 > &mat, const VecBase< T, 3 > &direction)
MatT from_rot_scale(const RotationT &rotation, const VectorT &scale)
MatBase< T, NumCol, NumRow > rotate(const MatBase< T, NumCol, NumRow > &mat, const RotationT &rotation)
CartesianBasis from_orthonormal_axes(const AxisSigned forward, const AxisSigned up)
MatT from_rotation(const RotationT &rotation)
T hypot(const T &y, const T &x)
T determinant(const MatBase< T, Size, Size > &mat)
Euler3Base< T > to_euler(const AxisAngleBase< T, AngleT > &axis_angle, EulerOrder order)
void transform_points(const float4x4 &transform, MutableSpan< float3 > points, bool use_threading=true)
MatT from_loc_rot_scale(const typename MatT::loc_type &location, const RotationT &rotation, const VecBase< typename MatT::base_type, ScaleDim > &scale)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
bool is_orthogonal(const MatT &mat)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
BLI_STATIC_ASSERT(ARRAY_SIZE(data_mode_strings)==CTX_MODE_NUM+1, "Must have a string for each context mode") const char *CTX_data_mode_string(const bContext *C)
MatBase< float, 4, 4 > float4x4
MatBase< double, 3, 3 > double3x3
VecBase< float, 2 > float2
MatBase< float, 3, 3 > float3x3
VecBase< float, 3 > float3
constexpr void unroll(Fn fn)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
static MatBase identity()
AngleRadianBase()=default
Euler3Base wrapped_around(const Euler3Base &reference) const
const EulerOrder & order() const
EulerXYZBase wrapped_around(const EulerXYZBase &reference) const
static QuaternionBase identity()