getBeerreturntrue/bindings.cpp

23 lines
748 B
C++

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "gamematrix.h"
namespace py = pybind11;
// Helfer, um Vec3/Array zurückzugeben (optional, falls translate rot3D std::vector<std::vector<double>> nutzt)
PYBIND11_MODULE(gamematrix_python, m) {
m.doc() = "gamematrix library exposed to Python";
// Matrizenmultiplikation
m.def("matmul", &gameMatrix::matmul, "Multiply two 4x4 matrices");
// Translation
m.def("translate", [](double x, double y, double z) {
return gameMatrix::translate({x, y, z});
}, "Generate a translation matrix from x,y,z");
// 3D Rotation
m.def("rot3D", &gameMatrix::rot3D,
"Generate a 4x4 rotation matrix given angle in degrees and axis ('x','y','z')");
}