Skip to content

Commit

Permalink
Removed unused Vector3::min() and ::max()
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Mott committed Apr 2, 2021
1 parent af5542a commit 37c2d45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
10 changes: 0 additions & 10 deletions libs/math/Vector3.h
Expand Up @@ -368,16 +368,6 @@ class BasicVector3
return _v;
}

// Returns the maximum absolute value of the components
Element max() const {
return std::max(fabs(_v[0]), std::max(fabs(_v[1]), fabs(_v[2])));
}

// Returns the minimum absolute value of the components
Element min() const {
return std::min(fabs(_v[0]), std::min(fabs(_v[1]), fabs(_v[2])));
}

template<typename OtherT>
bool isParallel(const BasicVector3<OtherT>& other) const
{
Expand Down
12 changes: 5 additions & 7 deletions plugins/script/interfaces/MathInterface.cpp
Expand Up @@ -20,7 +20,7 @@ void MathInterface::registerInterface(py::module& scope, py::dict& globals)
py::class_<Vector3> vec3(scope, "Vector3");
vec3.def(py::init<double, double, double>());
vec3.def(py::init<const Vector3&>());

// greebo: Pick the correct overload - this is hard to read, but it is necessary
vec3.def("x", static_cast<double& (Vector3::*)()>(&Vector3::x), py::return_value_policy::reference);
vec3.def("y", static_cast<double& (Vector3::*)()>(&Vector3::y), py::return_value_policy::reference);
Expand All @@ -33,18 +33,16 @@ void MathInterface::registerInterface(py::module& scope, py::dict& globals)
vec3.def("dot", &Vector3::dot<double>);
vec3.def("angle", &Vector3::angle<double>);
vec3.def("crossProduct", &Vector3::crossProduct<double>);
vec3.def("max", &Vector3::max);
vec3.def("min", &Vector3::min);
vec3.def("isParallel", &Vector3::isParallel<double>);
// Most important operators
vec3.def(py::self + py::self); // __add__
vec3.def(py::self - py::self); // __sub__
vec3.def(py::self += py::self); // __iadd__
vec3.def(py::self -= py::self); // __isub__
vec3.def(py::self < py::self); // __lt__
vec3.def("__repr__", [](const Vector3& vec)
{
return "(" + string::to_string(vec.x()) + " " + string::to_string(vec.y()) +
vec3.def("__repr__", [](const Vector3& vec)
{
return "(" + string::to_string(vec.x()) + " " + string::to_string(vec.y()) +
" " + string::to_string(vec.z()) + ")";
});

Expand Down Expand Up @@ -97,7 +95,7 @@ void MathInterface::registerInterface(py::module& scope, py::dict& globals)
vec4.def(py::self -= py::self);
vec4.def("__repr__", [](const Vector4& vec)
{
return "(" + string::to_string(vec.x()) + " " + string::to_string(vec.y()) + " " +
return "(" + string::to_string(vec.x()) + " " + string::to_string(vec.y()) + " " +
string::to_string(vec.z()) + " " + string::to_string(vec.w()) + ")";
});

Expand Down

0 comments on commit 37c2d45

Please sign in to comment.