Browse Source

python: expose new Matrix4.normal_matrix() and related APIs.

Should have gone into 2019.10 already, but I forgot.
pull/8/head
Vladimír Vondruš 7 years ago
parent
commit
97062bcc04
  1. 2
      doc/python/pages/changelog.rst
  2. 9
      src/python/magnum/math.matrix.h

2
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`_

9
src/python/magnum/math.matrix.h

@ -241,6 +241,12 @@ template<class T, class ...Args> void everyMatrix(py::class_<T, Args...>& 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<class T> void matrix(py::class_<T>& 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<T>::uniformScaling,
"Uniform scaling part of the matrix")
.def("normal_matrix", &Math::Matrix4<T>::normalMatrix,
"Normal matrix")
.def("inverted_rigid", &Math::Matrix4<T>::invertedRigid,
"Inverted rigid transformation matrix")
.def("transform_vector", &Math::Matrix4<T>::transformVector,

Loading…
Cancel
Save