diff --git a/doc/python/pages/changelog.rst b/doc/python/pages/changelog.rst index 8e18cfc..f8e019a 100644 --- a/doc/python/pages/changelog.rst +++ b/doc/python/pages/changelog.rst @@ -35,6 +35,8 @@ Changelog `Changes since 2019.10`_ ======================== +- Exposed `Matrix4.cofactor()`, `Matrix4.comatrix()`, `Matrix4.adjugate()` + (and equivalents in other matrix sizes), and `Matrix4.normal_matrix()` - Exposed `gl.AbstractFramebuffer.blit()` functions and related enums `2019.10`_ diff --git a/src/python/magnum/math.matrix.h b/src/python/magnum/math.matrix.h index 08bd8c2..a79aa5c 100644 --- a/src/python/magnum/math.matrix.h +++ b/src/python/magnum/math.matrix.h @@ -241,6 +241,12 @@ template void everyMatrix(py::class_& c) { }, "Construct an identity matrix", py::arg("value") = typename T::Type(1)) /* Methods */ + .def("comatrix", [](const T& self) -> T { + return self.comatrix(); + }, "Matrix of cofactors") + .def("adjugate", [](const T& self) -> T { + return self.adjugate(); + }, "Adjugate matrix") .def("inverted", &T::inverted, "Inverted matrix") .def("inverted_orthogonal", &T::invertedOrthogonal, "Inverted orthogonal matrix") .def("__matmul__", [](const T& self, const T& other) -> T { @@ -256,6 +262,7 @@ template void matrix(py::class_& c) { /* Member functions for square matrices only */ .def("is_orthogonal", &T::isOrthogonal, "Whether the matrix is orthogonal") .def("trace", &T::trace, "Trace of the matrix") + .def("cofactor", &T::cofactor, "Cofactor", py::arg("col"), py::arg("row")) .def("determinant", &T::determinant, "Determinant"); } @@ -788,6 +795,8 @@ Overloaded function. "Uniform scaling part of the matrix, squared") .def("uniform_scaling", &Math::Matrix4::uniformScaling, "Uniform scaling part of the matrix") + .def("normal_matrix", &Math::Matrix4::normalMatrix, + "Normal matrix") .def("inverted_rigid", &Math::Matrix4::invertedRigid, "Inverted rigid transformation matrix") .def("transform_vector", &Math::Matrix4::transformVector,