Skip to content

Commit

Permalink
Use IMATH_NAMESPACE
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Barejko <[email protected]>
  • Loading branch information
bareya committed Jan 20, 2025
1 parent 519afbb commit 67b9f06
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
30 changes: 15 additions & 15 deletions src/pybind11/PyBindImath/PyBindImathFrustum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ template<typename T>
struct GetClassName {};

template <>
struct GetClassName<Imath::Frustumf> {
struct GetClassName<IMATH_NAMESPACE::Frustumf> {
static constexpr const char* value = "Frustumf";
};

template <>
struct GetClassName<Imath::Frustumd> {
struct GetClassName<IMATH_NAMESPACE::Frustumd> {
static constexpr const char* value = "Frustumd";
};

Expand Down Expand Up @@ -88,23 +88,23 @@ void register_Frustum(py::module& m, const char *name)
"F.orthographic() -- returns whether frustum "
"F is orthographic or not")

.def("planes", [](F const& self, Imath::Plane3<T>* planes) -> void
.def("planes", [](F const& self, IMATH_NAMESPACE::Plane3<T>* planes) -> void
{
self.planes(planes);
})
.def("planes", [](F const& self, Imath::Plane3<T> *p, Imath::Matrix44<T> const& m) -> void
.def("planes", [](F const& self, IMATH_NAMESPACE::Plane3<T> *p, IMATH_NAMESPACE::Matrix44<T> const& m) -> void
{
self.planes(p, m);
})
.def("planes", [](F const& self, Imath::Matrix44<T> const& m)
.def("planes", [](F const& self, IMATH_NAMESPACE::Matrix44<T> const& m)
{
Imath::Plane3<T> p[6];
IMATH_NAMESPACE::Plane3<T> p[6];
self.planes(p, m);
return py::make_tuple(p[0], p[1], p[2], p[3], p[4], p[5]);
})
.def("planes", [](F const& self)
{
Imath::Plane3<T> p[6];
IMATH_NAMESPACE::Plane3<T> p[6];
self.planes(p);

return py::make_tuple(p[0],p[1],p[2],p[3],p[4],p[5]);
Expand Down Expand Up @@ -137,25 +137,25 @@ void register_Frustum(py::module& m, const char *name)
"F.projectScreenToRay(V) -- returns a Line3 "
"through V, a V2 point in screen space")

.def("projectScreenToRay", [](F const& self, py::sequence const& seq) -> Imath::Line3<T> {
.def("projectScreenToRay", [](F const& self, py::sequence const& seq) -> IMATH_NAMESPACE::Line3<T> {
if(seq.size() != 2) {
throw std::invalid_argument ( "projectScreenToRay expects a sequence of length 2");
}

Imath::Vec2<T> const point{py::cast<T>(seq[0]), py::cast<T>(seq[1])};
IMATH_NAMESPACE::Vec2<T> const point{py::cast<T>(seq[0]), py::cast<T>(seq[1])};
return self.projectScreenToRay(point);
})

.def("projectPointToScreen", &F::projectPointToScreen,
"F.projectPointToScreen(V) -- returns the "
"projection of V3 V into screen space")

.def("projectPointToScreen", [](F const& self, py::sequence const& seq) -> Imath::Vec2<T> {
.def("projectPointToScreen", [](F const& self, py::sequence const& seq) -> IMATH_NAMESPACE::Vec2<T> {
if(seq.size() != 3) {
throw std::invalid_argument ( "projectPointToScreen expects a sequence of length 3");
}

Imath::Vec3<T> const point{py::cast<T>(seq[0]), py::cast<T>(seq[1]), py::cast<T>(seq[2])};
IMATH_NAMESPACE::Vec3<T> const point{py::cast<T>(seq[0]), py::cast<T>(seq[1]), py::cast<T>(seq[2])};
return self.projectPointToScreen(point);
})

Expand Down Expand Up @@ -192,7 +192,7 @@ void register_Frustum(py::module& m, const char *name)
throw std::invalid_argument ( "worldRadius expects a sequence of length 3");
}

Imath::Vec3<T> const point{py::cast<T>(seq[0]), py::cast<T>(seq[1]), py::cast<T>(seq[2])};
IMATH_NAMESPACE::Vec3<T> const point{py::cast<T>(seq[0]), py::cast<T>(seq[1]), py::cast<T>(seq[2])};
return self.worldRadius(point, radius);
})

Expand All @@ -207,7 +207,7 @@ void register_Frustum(py::module& m, const char *name)
throw std::invalid_argument ("screenRadius expects a sequence of length 3");
}

Imath::Vec3<T> const point{py::cast<T>(seq[0]), py::cast<T>(seq[1]), py::cast<T>(seq[2])};
IMATH_NAMESPACE::Vec3<T> const point{py::cast<T>(seq[0]), py::cast<T>(seq[1]), py::cast<T>(seq[2])};
return self.screenRadius(point, radius);
})
;
Expand All @@ -217,8 +217,8 @@ void register_Frustum(py::module& m, const char *name)

void register_imath_frustum(py::module &m)
{
register_Frustum<Imath::Frustumf>(m, "Frustumf");
register_Frustum<Imath::Frustumd>(m, "Frustumd");
register_Frustum<IMATH_NAMESPACE::Frustumf>(m, "Frustumf");
register_Frustum<IMATH_NAMESPACE::Frustumd>(m, "Frustumd");
}

} // PyBindImath
8 changes: 4 additions & 4 deletions src/pybind11/PyBindImath/PyBindImathMatrix44.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ template<typename T>
struct GetClassName {};

template <>
struct GetClassName<Imath::M44f> {
struct GetClassName<IMATH_NAMESPACE::M44f> {
static constexpr const char* value = "Matrix44f";
};

template <>
struct GetClassName<Imath::M44d> {
struct GetClassName<IMATH_NAMESPACE::M44d> {
static constexpr const char* value = "Matrix44d";
};

Expand Down Expand Up @@ -97,8 +97,8 @@ void register_imath_matrix(py::module& m)
{
// TODO: M22 and M33

register_Matrix44<Imath::M44f, 4>(m);
register_Matrix44<Imath::M44d, 4>(m);
register_Matrix44<IMATH_NAMESPACE::M44f, 4>(m);
register_Matrix44<IMATH_NAMESPACE::M44d, 4>(m);
}

} // PyBindImath

0 comments on commit 67b9f06

Please sign in to comment.