/////////////////////////////////////////////////////////////////////////// // // Copyright (c) 1998-2011, Industrial Light & Magic, a division of Lucas // Digital Ltd. LLC // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Industrial Light & Magic nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // /////////////////////////////////////////////////////////////////////////// #ifndef _PyImathVec3Impl_h_ #define _PyImathVec3Impl_h_ // // This .C file was turned into a header file so that instantiations // of the various V3* types can be spread across multiple files in // order to work around MSVC limitations. // #include #include "PyImathDecorators.h" #include #include #include #include #include #include #include #include #include namespace PyImath { using namespace boost::python; using namespace IMATH_NAMESPACE; template struct Vec4Name { static const char *value(); }; // create a new default constructor that initializes Vec3 to zero. template static Vec4 * Vec4_construct_default() { return new Vec4(T(0),T(0),T(0),T(0)); } template static Vec4 * Vec4_object_constructor1(const object &obj) { Vec4 res; extract > e1(obj); extract > e2(obj); extract > e3(obj); extract e4(obj); extract e5(obj); extract e6(obj); if(e1.check()) { res = e1(); } else if(e2.check()) { res = e2(); } else if(e3.check()) { res = e3(); } else if(e4.check()) { tuple t = e4(); if(t.attr("__len__")() == 4) { res.x = extract(t[0]); res.y = extract(t[1]); res.z = extract(t[2]); res.w = extract(t[3]); } else THROW(IEX_NAMESPACE::LogicExc, "tuple must have length of 4"); } else if(e5.check()) { T a = (T) e5(); res = IMATH_NAMESPACE::Vec4(a, a, a, a); } else if(e6.check()) { list l = e6(); if(l.attr("__len__")() == 4) { res.x = extract(l[0]); res.y = extract(l[1]); res.z = extract(l[2]); res.w = extract(l[3]); } else THROW(IEX_NAMESPACE::LogicExc, "list must have length of 4"); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to Vec4 constructor"); Vec4 *v = new Vec4; *v = res; return v; } template static Vec4 * Vec4_object_constructor2(const object &obj1, const object &obj2, const object &obj3, const object& obj4) { extract e1(obj1); extract e2(obj2); extract e3(obj3); extract e4(obj4); Vec4 *v = new Vec4; if(e1.check()) { v->x = (T) e1();} else { THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to Vec4 constructor"); } if(e2.check()) { v->y = (T) e2();} else { THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to Vec4 constructor"); } if(e3.check()) { v->z = (T) e3();} else { THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to Vec4 constructor"); } if(e4.check()) { v->w = (T) e4();} else { THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to Vec4 constructor"); } return v; } // Implementations of str and repr are same here, // but we'll specialize repr for float and double to make them exact. template static std::string Vec4_str(const Vec4 &v) { std::stringstream stream; stream << Vec4Name::value() << "(" << v.x << ", " << v.y << ", " << v.z << ", " << v.w << ")"; return stream.str(); } template static std::string Vec4_repr(const Vec4 &v) { std::stringstream stream; stream << Vec4Name::value() << "(" << v.x << ", " << v.y << ", " << v.z << ", " << v.w << ")"; return stream.str(); } template static T Vec4_dot(const IMATH_NAMESPACE::Vec4 &v, const IMATH_NAMESPACE::Vec4 &other) { MATH_EXC_ON; return v.dot(other); } template static FixedArray Vec4_dot_Vec4Array(const IMATH_NAMESPACE::Vec4 &va, const FixedArray > &vb) { PY_IMATH_LEAVE_PYTHON; size_t len = vb.len(); FixedArray f(len); for (size_t i = 0; i < len; ++i) f[i] = va.dot(vb[i]); return f; } template static T Vec4_length(const IMATH_NAMESPACE::Vec4 &v) { MATH_EXC_ON; return v.length(); } template static T Vec4_length2(const IMATH_NAMESPACE::Vec4 &v) { MATH_EXC_ON; return v.length2(); } template static const Vec4 & Vec4_normalize(IMATH_NAMESPACE::Vec4 &v) { MATH_EXC_ON; return v.normalize(); } template static const Vec4 & Vec4_normalizeExc(IMATH_NAMESPACE::Vec4 &v) { MATH_EXC_ON; return v.normalizeExc(); } template static const Vec4 & Vec4_normalizeNonNull(IMATH_NAMESPACE::Vec4 &v) { MATH_EXC_ON; return v.normalizeNonNull(); } template static Vec4 Vec4_normalized(const IMATH_NAMESPACE::Vec4 &v) { MATH_EXC_ON; return v.normalized(); } template static Vec4 Vec4_normalizedExc(const IMATH_NAMESPACE::Vec4 &v) { MATH_EXC_ON; return v.normalizedExc(); } template static Vec4 Vec4_normalizedNonNull(const IMATH_NAMESPACE::Vec4 &v) { MATH_EXC_ON; return v.normalizedNonNull(); } template static const Vec4 & Vec4_negate(IMATH_NAMESPACE::Vec4 &v) { MATH_EXC_ON; return v.negate(); } template static Vec4 orthogonal(const Vec4 &v, const Vec4 &v0) { MATH_EXC_ON; return IMATH_NAMESPACE::orthogonal(v, v0); } template static Vec4 project(const Vec4 &v, const Vec4 &v0) { MATH_EXC_ON; return IMATH_NAMESPACE::project(v0, v); } template static Vec4 reflect(const Vec4 &v, const Vec4 &v0) { MATH_EXC_ON; return IMATH_NAMESPACE::reflect(v, v0); } template static void setValue(Vec4 &v, T a, T b, T c, T d) { v.x = a; v.y = b; v.z = c; v.w = d; } template static Vec4 Vec4_add (const Vec4 &v, const Vec4 &w) { MATH_EXC_ON; return v + w; } template static Vec4 Vec4_sub (const Vec4 &v, const Vec4 &w) { MATH_EXC_ON; return v - w; } template static Vec4 Vec4_neg (const Vec4 &v) { MATH_EXC_ON; return -v; } template static Vec4 Vec4_mul (const Vec4 &v, Vec4 &w) { MATH_EXC_ON; Vec4 w2 (w); return v * w2; } template static Vec4 Vec4_mulT (const Vec4 &v, T t) { MATH_EXC_ON; return v * t; } template static FixedArray > Vec4_mulTArray (const Vec4 &v, const FixedArray &t) { PY_IMATH_LEAVE_PYTHON; size_t len = t.len(); FixedArray > retval(len); for (size_t i=0; i static FixedArray > Vec4_rmulTArray (const Vec4 &v, const FixedArray &t) { return Vec4_mulTArray(v,t); } template static Vec4 Vec4_div (Vec4 &v, Vec4 &w) { MATH_EXC_ON; return v / w; } template static Vec4 Vec4_rmulT (Vec4 &v, T t) { MATH_EXC_ON; return t * v; } template static const Vec4 & Vec4_imulV(Vec4 &v, const Vec4 &w) { MATH_EXC_ON; return v *= w; } template static const Vec4 & Vec4_imulT(IMATH_NAMESPACE::Vec4 &v, T t) { MATH_EXC_ON; return v *= t; } template static Vec4 Vec4_mulM44 (Vec4 &v, const Matrix44 &m) { MATH_EXC_ON; return v * m; } template static const Vec4 & Vec4_idivObj(IMATH_NAMESPACE::Vec4 &v, const object &o) { MATH_EXC_ON; Vec4 v2; if (PyImath::V4::convert (o.ptr(), &v2)) { return v /= v2; } else { extract e(o); if (e.check()) return v /= (T) e(); else THROW (IEX_NAMESPACE::ArgExc, "V4 division expects an argument " "convertible to a V4"); } } template static Vec4 Vec4_subT(const Vec4 &v, T a) { MATH_EXC_ON; Vec4 w; setValue(w, (T) (v.x - a), (T) (v.y - a), (T) (v.z - a), (T) (v.w - a)); return w; } template static Vec4 Vec4_subTuple(const Vec4 &v, const BoostPyType &t) { MATH_EXC_ON; Vec4 w; if(t.attr("__len__")() == 4) { w.x = v.x - extract(t[0]); w.y = v.y - extract(t[1]); w.z = v.z - extract(t[2]); w.w = v.w - extract(t[3]); } else THROW(IEX_NAMESPACE::LogicExc, "tuple must have length of 4"); return w; } template static Vec4 Vec4_rsubT(const Vec4 &v, T a) { MATH_EXC_ON; Vec4 w(a - v.x, a - v.y, a - v.z, a - v.w); return w; } template static Vec4 Vec4_rsubTuple(const Vec4 &v, const BoostPyType &t) { MATH_EXC_ON; Vec4 w; if(t.attr("__len__")() == 4) { w.x = extract(t[0]) - v.x; w.y = extract(t[1]) - v.y; w.z = extract(t[2]) - v.z; w.w = extract(t[3]) - v.w; } else THROW(IEX_NAMESPACE::LogicExc, "tuple must have length of 4"); return w; } template static Vec4 Vec4_addTuple(const Vec4 &v, const BoostPyType &t) { MATH_EXC_ON; Vec4 w; if(t.attr("__len__")() == 4) { w.x = v.x + extract(t[0]); w.y = v.y + extract(t[1]); w.z = v.z + extract(t[2]); w.w = v.w + extract(t[3]); } else THROW(IEX_NAMESPACE::LogicExc, "tuple must have length of 4"); return w; } template static Vec4 Vec4_addT(const Vec4 &v, T a) { MATH_EXC_ON; Vec4 w; setValue(w, (T) (v.x + a), (T) (v.y + a), (T) (v.z + a), (T) (v.w + a)); return w; } template static Vec4 Vec4_addV(const Vec4 &v, const Vec4 &w) { MATH_EXC_ON; return v + w; } template static const Vec4 & Vec4_iaddV(Vec4 &v, const Vec4 &w) { MATH_EXC_ON; return v += w; } template static Vec4 Vec4_subV(const Vec4 &v, const Vec4 &w) { MATH_EXC_ON; return v - w; } template static const Vec4 & Vec4_isubV(Vec4 &v, const Vec4 &w) { MATH_EXC_ON; return v -= w; } template static Vec4 mult(const Vec4 &v, tuple t) { MATH_EXC_ON; Vec4 w; if(t.attr("__len__")() == 1){ w.x = v.x*extract(t[0]); w.y = v.y*extract(t[0]); w.z = v.z*extract(t[0]); w.w = v.w*extract(t[0]); } else if(t.attr("__len__")() == 4){ w.x = v.x*extract(t[0]); w.y = v.y*extract(t[1]); w.z = v.z*extract(t[2]); w.w = v.w*extract(t[3]); } else THROW(IEX_NAMESPACE::LogicExc, "tuple must have length of 1 or 4"); return w; } template static const Vec4 & Vec4_imulM44 (Vec4 &v, const Matrix44 &m) { MATH_EXC_ON; return v *= m; } template static Vec4 Vec4_divTuple(const Vec4 &v, const BoostPyType &t) { if(t.attr("__len__")() == 4) { T x = extract(t[0]); T y = extract(t[1]); T z = extract(t[2]); T w = extract(t[3]); if(x != T(0) && y != T(0) && z != T(0) && w != T(0)) return Vec4(v.x / x, v.y / y, v.z / z, v.w / w); else THROW(IEX_NAMESPACE::MathExc, "Division by zero"); } else THROW(IEX_NAMESPACE::LogicExc, "Vec4 expects tuple of length 4"); } template static Vec4 Vec4_rdivTuple(const Vec4 &v, const BoostPyType &t) { MATH_EXC_ON; Vec4 res; if(t.attr("__len__")() == 4) { T x = extract(t[0]); T y = extract(t[1]); T z = extract(t[2]); T w = extract(t[3]); if(v.x != T(0) && v.y != T(0) && v.z != T(0) && v.w != T(0)){ setValue(res, (T) (x / v.x), (T) (y / v.y), (T) (z / v.z), (T) (w / v.w)); } else THROW(IEX_NAMESPACE::MathExc, "Division by zero"); } else THROW(IEX_NAMESPACE::LogicExc, "tuple must have length of 4"); return res; } template static Vec4 Vec4_divT(const Vec4 &v, T a) { MATH_EXC_ON; Vec4 res; if(a != T(0)){ setValue(res, (T) (v.x / a), (T) (v.y / a), (T) (v.z / a), (T) (v.w / a)); } else THROW(IEX_NAMESPACE::MathExc, "Division by zero"); return res; } template static Vec4 Vec4_rdivT(const Vec4 &v, T a) { MATH_EXC_ON; Vec4 res; if(v.x != T(0) && v.y != T(0) && v.z != T(0) && v.w != T(0)){ setValue(res, (T) (a / v.x), (T) (a / v.y), (T) (a / v.z), (T) (a / v.w)); } else THROW(IEX_NAMESPACE::MathExc, "Division by zero"); return res; } template static Vec4 Vec4_Vec4_mulT(const Vec4& v, const Vec4& w) { MATH_EXC_ON; return v*w; } template static Vec4 Vec4_Vec4_divT(const Vec4& v, const Vec4& w) { MATH_EXC_ON; return v/w; } template static bool lessThan(const Vec4 &v, const object &obj) { extract > e1(obj); extract e2(obj); Vec4 res; if(e1.check()) { res = e1(); } else if(e2.check()) { tuple t = e2(); T x = extract(t[0]); T y = extract(t[1]); T z = extract(t[2]); T w = extract(t[3]); setValue(res,x,y,z,w); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to operator <"); bool isLessThan = (v.x <= res.x && v.y <= res.y && v.z <= res.z && v.w <= res.w) && v != res; return isLessThan; } template static bool greaterThan(const Vec4 &v, const object &obj) { extract > e1(obj); extract e2(obj); Vec4 res; if(e1.check()) { res = e1(); } else if(e2.check()) { tuple t = e2(); T x = extract(t[0]); T y = extract(t[1]); T z = extract(t[2]); T w = extract(t[3]); setValue(res,x,y,z,w); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to operator >"); bool isGreaterThan = (v.x >= res.x && v.y >= res.y && v.z >= res.z && v.w >= res.w) && v != res; return isGreaterThan; } template static bool lessThanEqual(const Vec4 &v, const object &obj) { extract > e1(obj); extract e2(obj); Vec4 res; if(e1.check()) { res = e1(); } else if(e2.check()) { tuple t = e2(); T x = extract(t[0]); T y = extract(t[1]); T z = extract(t[2]); T w = extract(t[2]); setValue(res,x,y,z,w); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to operator <="); bool isLessThanEqual = (v.x <= res.x && v.y <= res.y && v.z <= res.z && v.w <= res.w); return isLessThanEqual; } template static bool greaterThanEqual(const Vec4 &v, const object &obj) { extract > e1(obj); extract e2(obj); Vec4 res; if(e1.check()) { res = e1(); } else if(e2.check()) { tuple t = e2(); T x = extract(t[0]); T y = extract(t[1]); T z = extract(t[2]); T w = extract(t[3]); setValue(res,x,y,z,w); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to operator >="); bool isGreaterThanEqual = (v.x >= res.x && v.y >= res.y && v.z >= res.z && v.w >= res.w); return isGreaterThanEqual; } template static bool equalWithAbsErrorObj(const Vec4 &v, const object &obj1, const object &obj2) { extract > e1(obj1); extract > e2(obj1); extract > e3(obj1); extract e4(obj1); extract e5(obj2); Vec4 res; if(e1.check()) { res = e1(); } else if(e2.check()) { res = e2(); } else if(e3.check()) { res = e3(); } else if(e4.check()) { tuple t = e4(); if(t.attr("__len__")() == 4) { res.x = extract(t[0]); res.y = extract(t[1]); res.z = extract(t[2]); res.z = extract(t[3]); } else THROW(IEX_NAMESPACE::LogicExc, "tuple of length 4 expected"); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to equalWithAbsError"); if(e5.check()) { return v.equalWithAbsError(res, (T) e5()); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to equalWithAbsError"); } template static bool equalWithRelErrorObj(const Vec4 &v, const object &obj1, const object &obj2) { extract > e1(obj1); extract > e2(obj1); extract > e3(obj1); extract e4(obj1); extract e5(obj2); Vec4 res; if(e1.check()) { res = e1(); } else if(e2.check()) { res = e2(); } else if(e3.check()) { res = e3(); } else if(e4.check()) { tuple t = e4(); if(t.attr("__len__")() == 4) { res.x = extract(t[0]); res.y = extract(t[1]); res.z = extract(t[2]); res.w = extract(t[3]); } else THROW(IEX_NAMESPACE::LogicExc, "tuple of length 4 expected"); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to equalWithRelError"); if(e5.check()) { return v.equalWithRelError(res, (T) e5()); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to equalWithRelError"); } template static bool equal(const Vec4 &v, const tuple &t) { Vec4 res; if(t.attr("__len__")() == 4) { res.x = extract(t[0]); res.y = extract(t[1]); res.z = extract(t[2]); res.w = extract(t[3]); return (v == res); } else THROW(IEX_NAMESPACE::LogicExc, "tuple of length 4 expected"); } template static bool notequal(const Vec4 &v, const tuple &t) { Vec4 res; if(t.attr("__len__")() == 4) { res.x = extract(t[0]); res.y = extract(t[1]); res.z = extract(t[2]); res.z = extract(t[3]); return (v != res); } else THROW(IEX_NAMESPACE::LogicExc, "tuple of length 4 expected"); } template class_ > register_Vec4() { typedef PyImath::StaticFixedArray,T,4> Vec4_helper; class_ > vec4_class(Vec4Name::value(), Vec4Name::value(),init >("copy construction")); vec4_class .def("__init__",make_constructor(Vec4_construct_default),"initialize to (0,0,0,0)") .def("__init__",make_constructor(Vec4_object_constructor1)) .def("__init__",make_constructor(Vec4_object_constructor2)) .def_readwrite("x", &Vec4::x) .def_readwrite("y", &Vec4::y) .def_readwrite("z", &Vec4::z) .def_readwrite("w", &Vec4::w) .def("baseTypeEpsilon", &Vec4::baseTypeEpsilon,"baseTypeEpsilon() epsilon value of the base type of the vector") .staticmethod("baseTypeEpsilon") .def("baseTypeMax", &Vec4::baseTypeMax,"baseTypeMax() max value of the base type of the vector") .staticmethod("baseTypeMax") .def("baseTypeMin", &Vec4::baseTypeMin,"baseTypeMin() min value of the base type of the vector") .staticmethod("baseTypeMin") .def("baseTypeSmallest", &Vec4::baseTypeSmallest,"baseTypeSmallest() smallest value of the base type of the vector") .staticmethod("baseTypeSmallest") .def("dimensions", &Vec4::dimensions,"dimensions() number of dimensions in the vector") .staticmethod("dimensions") .def("dot", &Vec4_dot,"v1.dot(v2) inner product of the two vectors") .def("dot", &Vec4_dot_Vec4Array,"v1.dot(v2) array inner product") .def("equalWithAbsError", &Vec4::equalWithAbsError, "v1.equalWithAbsError(v2) true if the elements " "of v1 and v2 are the same with an absolute error of no more than e, " "i.e., abs(v1[i] - v2[i]) <= e") .def("equalWithAbsError", &equalWithAbsErrorObj) .def("equalWithRelError", &Vec4::equalWithRelError, "v1.equalWithAbsError(v2) true if the elements " "of v1 and v2 are the same with an absolute error of no more than e, " "i.e., abs(v1[i] - v2[i]) <= e * abs(v1[i])") .def("equalWithRelError", &equalWithRelErrorObj) .def("length", &Vec4_length,"length() magnitude of the vector") .def("length2", &Vec4_length2,"length2() square magnitude of the vector") .def("normalize", &Vec4_normalize,return_internal_reference<>(), "v.normalize() destructively normalizes v and returns a reference to it") .def("normalizeExc", &Vec4_normalizeExc,return_internal_reference<>(), "v.normalizeExc() destructively normalizes V and returns a reference to it, throwing an exception if length() == 0") .def("normalizeNonNull", &Vec4_normalizeNonNull,return_internal_reference<>(), "v.normalizeNonNull() destructively normalizes V and returns a reference to it, faster if lngth() != 0") .def("normalized", &Vec4_normalized, "v.normalized() returns a normalized copy of v") .def("normalizedExc", &Vec4_normalizedExc, "v.normalizedExc() returns a normalized copy of v, throwing an exception if length() == 0") .def("normalizedNonNull", &Vec4_normalizedNonNull, "v.normalizedNonNull() returns a normalized copy of v, faster if lngth() != 0") .def("__len__", Vec4_helper::len) .def("__getitem__", Vec4_helper::getitem,return_value_policy()) .def("__setitem__", Vec4_helper::setitem) .def("negate", &Vec4_negate, return_internal_reference<>()) .def("orthogonal", &orthogonal) .def("project", &project) .def("reflect", &reflect) .def("setValue", &setValue) .def("__neg__", &Vec4_neg) .def("__mul__", &Vec4_mul) .def("__mul__", &Vec4_mul) .def("__mul__", &Vec4_mul) .def("__mul__", &Vec4_mulT) .def("__mul__", &Vec4_mulTArray) .def("__rmul__", &Vec4_rmulT) .def("__rmul__", &Vec4_rmulTArray) .def("__imul__", &Vec4_imulV,return_internal_reference<>()) .def("__imul__", &Vec4_imulV,return_internal_reference<>()) .def("__imul__", &Vec4_imulV,return_internal_reference<>()) .def("__imul__", &Vec4_imulT,return_internal_reference<>()) .def("__div__", &Vec4_Vec4_divT) .def("__truediv__", &Vec4_Vec4_divT) .def("__mul__", &Vec4_mulM44) .def("__mul__", &Vec4_mulM44) .def("__mul__", &Vec4_Vec4_mulT) .def("__div__", &Vec4_div) .def("__div__", &Vec4_div) .def("__div__", &Vec4_div) .def("__div__", &Vec4_divTuple) .def("__div__", &Vec4_divTuple) .def("__div__", &Vec4_divT) .def("__truediv__", &Vec4_div) .def("__truediv__", &Vec4_div) .def("__truediv__", &Vec4_div) .def("__truediv__", &Vec4_divTuple) .def("__truediv__", &Vec4_divTuple) .def("__truediv__", &Vec4_divT) .def("__rdiv__", &Vec4_rdivTuple) .def("__rdiv__", &Vec4_rdivTuple) .def("__rdiv__", &Vec4_rdivT) .def("__idiv__", &Vec4_idivObj,return_internal_reference<>()) .def("__itruediv__", &Vec4_idivObj,return_internal_reference<>()) .def("__xor__", &Vec4_dot) .def(self == self) .def(self != self) .def("__add__", &Vec4_add) .def("__add__", &Vec4_addV) .def("__add__", &Vec4_addV) .def("__add__", &Vec4_addV) .def("__add__", &Vec4_addT) .def("__add__", &Vec4_addTuple) .def("__add__", &Vec4_addTuple) .def("__radd__", &Vec4_addT) .def("__radd__", &Vec4_addTuple) .def("__radd__", &Vec4_addTuple) .def("__radd__", &Vec4_add) .def("__iadd__", &Vec4_iaddV, return_internal_reference<>()) .def("__iadd__", &Vec4_iaddV, return_internal_reference<>()) .def("__iadd__", &Vec4_iaddV, return_internal_reference<>()) .def("__sub__", &Vec4_sub) .def("__sub__", &Vec4_subV) .def("__sub__", &Vec4_subV) .def("__sub__", &Vec4_subV) .def("__sub__", &Vec4_subT) .def("__sub__", &Vec4_subTuple) .def("__sub__", &Vec4_subTuple) .def("__rsub__", &Vec4_rsubT) .def("__rsub__", &Vec4_rsubTuple) .def("__rsub__", &Vec4_rsubTuple) .def("__isub__", &Vec4_isubV, return_internal_reference<>()) .def("__isub__", &Vec4_isubV, return_internal_reference<>()) .def("__isub__", &Vec4_isubV, return_internal_reference<>()) .def("__mul__", &mult) .def("__rmul__", &mult) .def("__imul__", &Vec4_imulM44, return_internal_reference<>()) .def("__imul__", &Vec4_imulM44, return_internal_reference<>()) .def("__lt__", &lessThan) .def("__gt__", &greaterThan) .def("__le__", &lessThanEqual) .def("__ge__", &greaterThanEqual) .def("__eq__", &equal) .def("__ne__", ¬equal) //.def(self_ns::str(self)) .def("__str__",&Vec4_str) .def("__repr__",&Vec4_repr) ; decoratecopy(vec4_class); //add_swizzle3_operators(v3f_class); return vec4_class; } } // namespace PyImath #endif // _PyImathVec4Impl_h_