Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions src/pybind11/PyBindImath/PyBindImathEuler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ namespace PyBindImath {

// Function to register the Euler class methods
template <class T>
void register_euler_methods(pybind11::class_<Imath::Euler<T>, Imath::Vec3<T>>& c) {
void register_euler_methods(pybind11::class_<IMATH_NAMESPACE::Euler<T>, IMATH_NAMESPACE::Vec3<T>>& c) {
c.def(pybind11::init<>())
.def(pybind11::init<const Imath::Vec3<T>&, typename Imath::Euler<T>::Order>(), pybind11::arg("v"), pybind11::arg("order") = Imath::Euler<T>::XYZ)
.def(pybind11::init<T, T, T, typename Imath::Euler<T>::Order>(), pybind11::arg("x"), pybind11::arg("y"), pybind11::arg("z"), pybind11::arg("order") = Imath::Euler<T>::XYZ)
.def(pybind11::init<const IMATH_NAMESPACE::Vec3<T>&, typename IMATH_NAMESPACE::Euler<T>::Order>(), pybind11::arg("v"), pybind11::arg("order") = IMATH_NAMESPACE::Euler<T>::XYZ)
.def(pybind11::init<T, T, T, typename IMATH_NAMESPACE::Euler<T>::Order>(), pybind11::arg("x"), pybind11::arg("y"), pybind11::arg("z"), pybind11::arg("order") = IMATH_NAMESPACE::Euler<T>::XYZ)
.def(pybind11::self == pybind11::self)
.def(pybind11::self != pybind11::self)
.def("toMatrix33", &Imath::Euler<T>::toMatrix33)
.def("toMatrix44", &Imath::Euler<T>::toMatrix44)
.def("toQuat", &Imath::Euler<T>::toQuat)
.def("order", &Imath::Euler<T>::order)
.def("setOrder", &Imath::Euler<T>::setOrder)
.def("makeNear", &Imath::Euler<T>::makeNear)
.def("extract", pybind11::overload_cast<const Imath::Matrix33<T>&>(&Imath::Euler<T>::extract))
.def("extract", pybind11::overload_cast<const Imath::Matrix44<T>&>(&Imath::Euler<T>::extract))
.def("extract", pybind11::overload_cast<const Imath::Quat<T>&>(&Imath::Euler<T>::extract))
.def("toXYZVector", &Imath::Euler<T>::toXYZVector)
.def("__str__", [](const Imath::Euler<T>& e) {
.def("toMatrix33", &IMATH_NAMESPACE::Euler<T>::toMatrix33)
.def("toMatrix44", &IMATH_NAMESPACE::Euler<T>::toMatrix44)
.def("toQuat", &IMATH_NAMESPACE::Euler<T>::toQuat)
.def("order", &IMATH_NAMESPACE::Euler<T>::order)
.def("setOrder", &IMATH_NAMESPACE::Euler<T>::setOrder)
.def("makeNear", &IMATH_NAMESPACE::Euler<T>::makeNear)
.def("extract", pybind11::overload_cast<const IMATH_NAMESPACE::Matrix33<T>&>(&IMATH_NAMESPACE::Euler<T>::extract))
.def("extract", pybind11::overload_cast<const IMATH_NAMESPACE::Matrix44<T>&>(&IMATH_NAMESPACE::Euler<T>::extract))
.def("extract", pybind11::overload_cast<const IMATH_NAMESPACE::Quat<T>&>(&IMATH_NAMESPACE::Euler<T>::extract))
.def("toXYZVector", &IMATH_NAMESPACE::Euler<T>::toXYZVector)
.def("__str__", [](const IMATH_NAMESPACE::Euler<T>& e) {
std::stringstream stream;
stream << "Euler(" << e.x << ", " << e.y << ", " << e.z << ", " << e.order() << ")";
return stream.str();
})
.def("__repr__", [](const Imath::Euler<T>& e) {
.def("__repr__", [](const IMATH_NAMESPACE::Euler<T>& e) {
std::stringstream stream;
stream << "Euler(" << e.x << ", " << e.y << ", " << e.z << ", " << e.order() << ")";
return stream.str();
Expand All @@ -43,7 +43,7 @@ namespace PyBindImath {
// Function to register the Euler class in the module
template <class T>
void register_euler(pybind11::module& m, const char* name) {
pybind11::class_<Imath::Euler<T>, Imath::Vec3<T>> c(m, name);
pybind11::class_<IMATH_NAMESPACE::Euler<T>, IMATH_NAMESPACE::Vec3<T>> c(m, name);
register_euler_methods<T>(c);
}

Expand All @@ -54,31 +54,31 @@ namespace PyBindImath {

// Enums for Euler Orders
pybind11::enum_<Imath::Euler<float>::Order>(m, "Order")
.value("XYZ", Imath::Euler<float>::XYZ)
.value("XZY", Imath::Euler<float>::XZY)
.value("YZX", Imath::Euler<float>::YZX)
.value("YXZ", Imath::Euler<float>::YXZ)
.value("ZXY", Imath::Euler<float>::ZXY)
.value("ZYX", Imath::Euler<float>::ZYX)
.value("XZX", Imath::Euler<float>::XZX)
.value("XYX", Imath::Euler<float>::XYX)
.value("YXY", Imath::Euler<float>::YXY)
.value("YZY", Imath::Euler<float>::YZY)
.value("ZYZ", Imath::Euler<float>::ZYZ)
.value("ZXZ", Imath::Euler<float>::ZXZ)
.value("XYZ", IMATH_NAMESPACE::Euler<float>::XYZ)
.value("XZY", IMATH_NAMESPACE::Euler<float>::XZY)
.value("YZX", IMATH_NAMESPACE::Euler<float>::YZX)
.value("YXZ", IMATH_NAMESPACE::Euler<float>::YXZ)
.value("ZXY", IMATH_NAMESPACE::Euler<float>::ZXY)
.value("ZYX", IMATH_NAMESPACE::Euler<float>::ZYX)
.value("XZX", IMATH_NAMESPACE::Euler<float>::XZX)
.value("XYX", IMATH_NAMESPACE::Euler<float>::XYX)
.value("YXY", IMATH_NAMESPACE::Euler<float>::YXY)
.value("YZY", IMATH_NAMESPACE::Euler<float>::YZY)
.value("ZYZ", IMATH_NAMESPACE::Euler<float>::ZYZ)
.value("ZXZ", IMATH_NAMESPACE::Euler<float>::ZXZ)
.export_values();

// Enums for Axis
pybind11::enum_<Imath::Euler<float>::Axis>(m, "Axis")
.value("X", Imath::Euler<float>::X)
.value("Y", Imath::Euler<float>::Y)
.value("Z", Imath::Euler<float>::Z)
.value("X", IMATH_NAMESPACE::Euler<float>::X)
.value("Y", IMATH_NAMESPACE::Euler<float>::Y)
.value("Z", IMATH_NAMESPACE::Euler<float>::Z)
.export_values();

// Enums for InputLayout
pybind11::enum_<Imath::Euler<float>::InputLayout>(m, "InputLayout")
.value("XYZLayout", Imath::Euler<float>::XYZLayout)
.value("IJKLayout", Imath::Euler<float>::IJKLayout)
.value("XYZLayout", IMATH_NAMESPACE::Euler<float>::XYZLayout)
.value("IJKLayout", IMATH_NAMESPACE::Euler<float>::IJKLayout)
.export_values();
}

Expand Down
10 changes: 5 additions & 5 deletions src/pybind11/PyBindImath/PyBindImathFrustum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@

namespace PyBindImath {

template <class T, class V, class M>
template <class T, class V, class S>
void register_frustum(pybind11::module& m, const char *name)
{
pybind11::class_<T> c(m, name);
c.def(pybind11::init<>(), "Uninitialized by default")
.def(pybind11::init<T>(), pybind11::arg("frustum"), "Copy constructor")
.def(pybind11::init<S>(), pybind11::arg("nearPlane"), pybind11::arg("farPlane"), pybind11::arg("fovx"), pybind11::arg("aspect"), "Initialize with basic frustum properties")
.def(pybind11::init<const S, S, S, S>(), pybind11::arg("nearPlane"), pybind11::arg("farPlane"), pybind11::arg("fovx"), pybind11::arg("aspect"), "Initialize with basic frustum properties")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nearPlane, farPlane, fovx, and aspect are float/double, but S in this context is M44f/M44d, right?


.def_readwrite("nearPlane", &T::nearPlane, "The near clipping plane")
.def_readwrite("farPlane", &T::farPlane, "The far clipping plane")
.def_readwrite("fovx", &T::fovx, "The field of view in x direction")
.def_readwrite("aspect", &T::aspect, "The aspect ratio")

.def("set", pybind11::overload_cast<S, S, S, S>(&T::set), pybind11::arg("nearPlane"), pybind11::arg("farPlane"), pybind11::arg("fovx"), pybind11::arg("aspect"), "Set frustum properties")
.def("set", pybind11::overload_cast<const S, S, S, S>(&T::set), pybind11::arg("nearPlane"), pybind11::arg("farPlane"), pybind11::arg("fovx"), pybind11::arg("aspect"), "Set frustum properties")
.def("projectionMatrix", &T::projectionMatrix, "Returns the projection matrix of the frustum")
.def("transform", &T::transform, pybind11::arg("matrix"), "Applies a transformation matrix to the frustum")
.def("intersects", [](T& self, const V& point) {
Expand Down Expand Up @@ -52,8 +52,8 @@ void register_frustum(pybind11::module& m, const char *name)

void register_imath_frustum(pybind11::module &m)
{
register_frustum<Imath::Frustumf, Imath::V3f, Imath::M44f>(m, "Frustumf");
register_frustum<Imath::Frustumd, Imath::V3d, Imath::M44d>(m, "Frustumd");
register_frustum<IMATH_NAMESPACE::Frustumf, IMATH_NAMESPACE::V3f, IMATH_NAMESPACE::M44f>(m, "Frustumf");
register_frustum<IMATH_NAMESPACE::Frustumd, IMATH_NAMESPACE::V3d, IMATH_NAMESPACE::M44d>(m, "Frustumd");
}

}
Loading