/////////////////////////////////////////////////////////////////////////// // // 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 Vec3Name { static const char *value(); }; // create a new default constructor that initializes Vec3 to zero. template static Vec3 * Vec3_construct_default() { return new Vec3(T(0),T(0),T(0)); } template static Vec3 * Vec3_object_constructor1(const object &obj) { Vec3 w; extract > e1(obj); extract > e2(obj); extract > e3(obj); extract e4(obj); extract e5(obj); extract e6(obj); if(e1.check()) { w = e1(); } else if(e2.check()) { w = e2(); } else if(e3.check()) { w = e3(); } else if(e4.check()) { tuple t = e4(); if(t.attr("__len__")() == 3) { w.x = extract(t[0]); w.y = extract(t[1]); w.z = extract(t[2]); } else THROW(IEX_NAMESPACE::LogicExc, "tuple must have length of 3"); } else if(e5.check()) { T a = e5(); w.setValue(a, a, a); } else if(e6.check()) { list l = e6(); if(l.attr("__len__")() == 3) { w.x = extract(l[0]); w.y = extract(l[1]); w.z = extract(l[2]); } else THROW(IEX_NAMESPACE::LogicExc, "list must have length of 3"); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to Vec3 constructor"); Vec3 *v = new Vec3; *v = w; return v; } template static Vec3 * Vec3_object_constructor2(const object &obj1, const object &obj2, const object &obj3) { extract e1(obj1); extract e2(obj2); extract e3(obj3); Vec3 *v = new Vec3; if(e1.check()) { v->x = e1();} else { THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to Vec3 constructor"); } if(e2.check()) { v->y = e2();} else { THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to Vec3 constructor"); } if(e3.check()) { v->z = e3();} else { THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to Vec3 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 Vec3_str(const Vec3 &v) { std::stringstream stream; stream << Vec3Name::value() << "(" << v.x << ", " << v.y << ", " << v.z << ")"; return stream.str(); } template static std::string Vec3_repr(const Vec3 &v) { std::stringstream stream; stream << Vec3Name::value() << "(" << v.x << ", " << v.y << ", " << v.z << ")"; return stream.str(); } template static IMATH_NAMESPACE::Vec3 Vec3_cross(const IMATH_NAMESPACE::Vec3 &v, const IMATH_NAMESPACE::Vec3 &other) { MATH_EXC_ON; return v.cross(other); } template static FixedArray > Vec3_cross_Vec3Array(const IMATH_NAMESPACE::Vec3 &va, const FixedArray > &vb) { MATH_EXC_ON; size_t len = vb.len(); FixedArray > f(len); for (size_t i = 0; i < len; ++i) f[i] = va.cross(vb[i]); return f; } template static T Vec3_dot(const IMATH_NAMESPACE::Vec3 &v, const IMATH_NAMESPACE::Vec3 &other) { MATH_EXC_ON; return v.dot(other); } template static FixedArray Vec3_dot_Vec3Array(const IMATH_NAMESPACE::Vec3 &va, const FixedArray > &vb) { MATH_EXC_ON; 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 Vec3_length(const IMATH_NAMESPACE::Vec3 &v) { MATH_EXC_ON; return v.length(); } template static T Vec3_length2(const IMATH_NAMESPACE::Vec3 &v) { MATH_EXC_ON; return v.length2(); } template static const Vec3 & Vec3_normalize(IMATH_NAMESPACE::Vec3 &v) { MATH_EXC_ON; return v.normalize(); } template static const Vec3 & Vec3_normalizeExc(IMATH_NAMESPACE::Vec3 &v) { MATH_EXC_ON; return v.normalizeExc(); } template static const Vec3 & Vec3_normalizeNonNull(IMATH_NAMESPACE::Vec3 &v) { MATH_EXC_ON; return v.normalizeNonNull(); } template static Vec3 Vec3_normalized(const IMATH_NAMESPACE::Vec3 &v) { MATH_EXC_ON; return v.normalized(); } template static Vec3 Vec3_normalizedExc(const IMATH_NAMESPACE::Vec3 &v) { MATH_EXC_ON; return v.normalizedExc(); } template static Vec3 Vec3_normalizedNonNull(const IMATH_NAMESPACE::Vec3 &v) { MATH_EXC_ON; return v.normalizedNonNull(); } template static Vec3 closestVertex(Vec3 &p, const Vec3 &v0, const Vec3 &v1, const Vec3 &v2) { MATH_EXC_ON; return IMATH_NAMESPACE::closestVertex(v0, v1, v2, p); } template static const Vec3 & Vec3_negate(IMATH_NAMESPACE::Vec3 &v) { MATH_EXC_ON; return v.negate(); } template static Vec3 orthogonal(const Vec3 &v, const Vec3 &v0) { MATH_EXC_ON; return IMATH_NAMESPACE::orthogonal(v, v0); } template static Vec3 project(const Vec3 &v, const Vec3 &v0) { MATH_EXC_ON; return IMATH_NAMESPACE::project(v0, v); } template static Vec3 reflect(const Vec3 &v, const Vec3 &v0) { MATH_EXC_ON; return IMATH_NAMESPACE::reflect(v, v0); } template static void setValue(Vec3 &v, T a, T b, T c) { v.x = a; v.y = b; v.z = c; } template static Vec3 Vec3_add (const Vec3 &v, const Vec3 &w) { MATH_EXC_ON; return v + w; } template static Vec3 Vec3_sub (const Vec3 &v, const Vec3 &w) { MATH_EXC_ON; return v - w; } template static Vec3 Vec3_neg (const Vec3 &v) { MATH_EXC_ON; return -v; } template static Vec3 Vec3_mul (const Vec3 &v, Vec3 &w) { MATH_EXC_ON; Vec3 w2 (w); return v * w2; } template static Vec3 Vec3_mulT (const Vec3 &v, T t) { MATH_EXC_ON; return v * t; } template static FixedArray > Vec3_mulTArray (const Vec3 &v, const FixedArray &t) { MATH_EXC_ON; size_t len = t.len(); FixedArray > retval(len); for (size_t i=0; i static FixedArray > Vec3_rmulTArray (const Vec3 &v, const FixedArray &t) { return Vec3_mulTArray(v,t); } template static Vec3 Vec3_div (Vec3 &v, Vec3 &w) { MATH_EXC_ON; return v / w; } template static Vec3 Vec3_rmulT (Vec3 &v, T t) { MATH_EXC_ON; return t * v; } template static const Vec3 & Vec3_imulV(Vec3 &v, const Vec3 &w) { MATH_EXC_ON; return v *= w; } template static const Vec3 & Vec3_imulT(IMATH_NAMESPACE::Vec3 &v, T t) { MATH_EXC_ON; return v *= t; } template static Vec3 Vec3_mulM33 (Vec3 &v, const Matrix33 &m) { MATH_EXC_ON; return v * m; } template static Vec3 Vec3_mulM44 (Vec3 &v, const Matrix44 &m) { MATH_EXC_ON; return v * m; } template static const Vec3 & Vec3_idivObj(IMATH_NAMESPACE::Vec3 &v, const object &o) { MATH_EXC_ON; Vec3 v2; if (PyImath::V3::convert (o.ptr(), &v2)) { return v /= v2; } else { extract e(o); if (e.check()) return v /= e(); else THROW (IEX_NAMESPACE::ArgExc, "V3 division expects an argument" "convertible to a V3"); } } template static Vec3 Vec3_subT(const Vec3 &v, T a) { MATH_EXC_ON; Vec3 w; w.setValue(v.x - a, v.y - a, v.z - a); return w; } template static Vec3 Vec3_subTuple(const Vec3 &v, const BoostPyType &t) { MATH_EXC_ON; Vec3 w; if(t.attr("__len__")() == 3) { w.x = v.x - extract(t[0]); w.y = v.y - extract(t[1]); w.z = v.z - extract(t[2]); } else THROW(IEX_NAMESPACE::LogicExc, "tuple must have length of 3"); return w; } template static Vec3 Vec3_rsubT(const Vec3 &v, T a) { MATH_EXC_ON; Vec3 w; w.setValue(a - v.x, a - v.y, a - v.z); return w; } template static Vec3 Vec3_rsubTuple(const Vec3 &v, const BoostPyType &t) { MATH_EXC_ON; Vec3 w; if(t.attr("__len__")() == 3) { w.x = extract(t[0]) - v.x; w.y = extract(t[1]) - v.y; w.z = extract(t[2]) - v.z; } else THROW(IEX_NAMESPACE::LogicExc, "tuple must have length of 3"); return w; } template static Vec3 Vec3_addTuple(const Vec3 &v, const BoostPyType &t) { MATH_EXC_ON; Vec3 w; if(t.attr("__len__")() == 3) { w.x = v.x + extract(t[0]); w.y = v.y + extract(t[1]); w.z = v.z + extract(t[2]); } else THROW(IEX_NAMESPACE::LogicExc, "tuple must have length of 3"); return w; } template static Vec3 Vec3_addT(const Vec3 &v, T a) { MATH_EXC_ON; Vec3 w; w.setValue(v.x + a, v.y + a, v.z + a); return w; } template static Vec3 Vec3_addV(const Vec3 &v, const Vec3 &w) { MATH_EXC_ON; return v + w; } template static const Vec3 & Vec3_iaddV(Vec3 &v, const Vec3 &w) { MATH_EXC_ON; return v += w; } template static Vec3 Vec3_subV(const Vec3 &v, const Vec3 &w) { MATH_EXC_ON; return v - w; } template static const Vec3 & Vec3_isubV(Vec3 &v, const Vec3 &w) { MATH_EXC_ON; return v -= w; } template static Vec3 mult(const Vec3 &v, tuple t) { MATH_EXC_ON; Vec3 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]); } else if(t.attr("__len__")() == 3){ w.x = v.x*extract(t[0]); w.y = v.y*extract(t[1]); w.z = v.z*extract(t[2]); } else THROW(IEX_NAMESPACE::LogicExc, "tuple must have length of 1 or 3"); return w; } template static const Vec3 & Vec3_imulM44 (Vec3 &v, const Matrix44 &m) { MATH_EXC_ON; return v *= m; } template static Vec3 Vec3_divTuple(const Vec3 &v, const BoostPyType &t) { if(t.attr("__len__")() == 3) { T x = extract(t[0]); T y = extract(t[1]); T z = extract(t[2]); if(x != T(0) && y != T(0) && z != T(0)) return Vec3(v.x / x, v.y / y, v.z / z); else THROW(IEX_NAMESPACE::MathExc, "Division by zero"); } else THROW(IEX_NAMESPACE::LogicExc, "Vec3 expects tuple of length 3"); } template static Vec3 Vec3_rdivTuple(const Vec3 &v, const BoostPyType &t) { MATH_EXC_ON; Vec3 w; if(t.attr("__len__")() == 3) { T x = extract(t[0]); T y = extract(t[1]); T z = extract(t[2]); if(v.x != T(0) && v.y != T(0) && v.z != T(0)){ w.setValue(x / v.x, y / v.y, z / v.z); } else THROW(IEX_NAMESPACE::MathExc, "Division by zero"); } else THROW(IEX_NAMESPACE::LogicExc, "tuple must have length of 3"); return w; } template static Vec3 Vec3_divT(const Vec3 &v, T a) { MATH_EXC_ON; Vec3 w; if(a != T(0)){ w.setValue(v.x / a, v.y / a, v.z / a); } else THROW(IEX_NAMESPACE::MathExc, "Division by zero"); return w; } template static Vec3 Vec3_rdivT(const Vec3 &v, T a) { MATH_EXC_ON; Vec3 w; if(v.x != T(0) && v.y != T(0) && v.z != T(0)){ w.setValue(a / v.x, a / v.y, a / v.z); } else THROW(IEX_NAMESPACE::MathExc, "Division by zero"); return w; } template static Vec3 Vec3_Vec3_mulT(const Vec3& v, const Vec3& w) { MATH_EXC_ON; return v*w; } template static Vec3 Vec3_Vec3_divT(const Vec3& v, const Vec3& w) { MATH_EXC_ON; return v/w; } template static bool lessThan(const Vec3 &v, const object &obj) { extract > e1(obj); extract e2(obj); Vec3 w; if(e1.check()) { w = e1(); } else if(e2.check()) { tuple t = e2(); T x = extract(t[0]); T y = extract(t[1]); T z = extract(t[2]); w.setValue(x,y,z); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to operator <"); bool isLessThan = (v.x <= w.x && v.y <= w.y && v.z <= w.z) && v != w; return isLessThan; } template static bool greaterThan(const Vec3 &v, const object &obj) { extract > e1(obj); extract e2(obj); Vec3 w; if(e1.check()) { w = e1(); } else if(e2.check()) { tuple t = e2(); T x = extract(t[0]); T y = extract(t[1]); T z = extract(t[2]); w.setValue(x,y,z); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to operator >"); bool isGreaterThan = (v.x >= w.x && v.y >= w.y && v.z >= w.z) && v != w; return isGreaterThan; } template static bool lessThanEqual(const Vec3 &v, const object &obj) { extract > e1(obj); extract e2(obj); Vec3 w; if(e1.check()) { w = e1(); } else if(e2.check()) { tuple t = e2(); T x = extract(t[0]); T y = extract(t[1]); T z = extract(t[2]); w.setValue(x,y,z); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to operator <="); bool isLessThanEqual = (v.x <= w.x && v.y <= w.y && v.z <= w.z); return isLessThanEqual; } template static bool greaterThanEqual(const Vec3 &v, const object &obj) { extract > e1(obj); extract e2(obj); Vec3 w; if(e1.check()) { w = e1(); } else if(e2.check()) { tuple t = e2(); T x = extract(t[0]); T y = extract(t[1]); T z = extract(t[2]); w.setValue(x,y,z); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to operator >="); bool isGreaterThanEqual = (v.x >= w.x && v.y >= w.y && v.z >= w.z); return isGreaterThanEqual; } template static bool equalWithAbsErrorObj(const Vec3 &v, const object &obj1, const object &obj2) { extract > e1(obj1); extract > e2(obj1); extract > e3(obj1); extract e4(obj1); extract e5(obj2); Vec3 w; if(e1.check()) { w = e1(); } else if(e2.check()) { w = e2(); } else if(e3.check()) { w = e3(); } else if(e4.check()) { tuple t = e4(); if(t.attr("__len__")() == 3) { w.x = extract(t[0]); w.y = extract(t[1]); w.z = extract(t[2]); } else THROW(IEX_NAMESPACE::LogicExc, "tuple of length 3 expected"); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to equalWithAbsError"); if(e5.check()) { return v.equalWithAbsError(w, e5()); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to equalWithAbsError"); } template static bool equalWithRelErrorObj(const Vec3 &v, const object &obj1, const object &obj2) { extract > e1(obj1); extract > e2(obj1); extract > e3(obj1); extract e4(obj1); extract e5(obj2); Vec3 w; if(e1.check()) { w = e1(); } else if(e2.check()) { w = e2(); } else if(e3.check()) { w = e3(); } else if(e4.check()) { tuple t = e4(); if(t.attr("__len__")() == 3) { w.x = extract(t[0]); w.y = extract(t[1]); w.z = extract(t[2]); } else THROW(IEX_NAMESPACE::LogicExc, "tuple of length 3 expected"); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to equalWithRelError"); if(e5.check()) { return v.equalWithRelError(w, e5()); } else THROW(IEX_NAMESPACE::LogicExc, "invalid parameters passed to equalWithRelError"); } template static bool equal(const Vec3 &v, const tuple &t) { Vec3 w; if(t.attr("__len__")() == 3) { w.x = extract(t[0]); w.y = extract(t[1]); w.z = extract(t[2]); return (v == w); } else THROW(IEX_NAMESPACE::LogicExc, "tuple of length 3 expected"); } template static bool notequal(const Vec3 &v, const tuple &t) { Vec3 w; if(t.attr("__len__")() == 3) { w.x = extract(t[0]); w.y = extract(t[1]); w.z = extract(t[2]); return (v != w); } else THROW(IEX_NAMESPACE::LogicExc, "tuple of length 3 expected"); } template class_ > register_Vec3() { typedef PyImath::StaticFixedArray,T,3> Vec3_helper; class_ > vec3_class(Vec3Name::value(), Vec3Name::value(),init >("copy construction")); vec3_class .def("__init__",make_constructor(Vec3_construct_default),"initialize to (0,0,0)") .def("__init__",make_constructor(Vec3_object_constructor1)) .def("__init__",make_constructor(Vec3_object_constructor2)) .def_readwrite("x", &Vec3::x) .def_readwrite("y", &Vec3::y) .def_readwrite("z", &Vec3::z) .def("baseTypeEpsilon", &Vec3::baseTypeEpsilon,"baseTypeEpsilon() epsilon value of the base type of the vector") .staticmethod("baseTypeEpsilon") .def("baseTypeMax", &Vec3::baseTypeMax,"baseTypeMax() max value of the base type of the vector") .staticmethod("baseTypeMax") .def("baseTypeMin", &Vec3::baseTypeMin,"baseTypeMin() min value of the base type of the vector") .staticmethod("baseTypeMin") .def("baseTypeSmallest", &Vec3::baseTypeSmallest,"baseTypeSmallest() smallest value of the base type of the vector") .staticmethod("baseTypeSmallest") .def("cross", &Vec3_cross,"v1.cross(v2) right handed cross product") .def("cross", &Vec3_cross_Vec3Array,"v1.cross(v2) right handed array cross product") .def("dimensions", &Vec3::dimensions,"dimensions() number of dimensions in the vector") .staticmethod("dimensions") .def("dot", &Vec3_dot,"v1.dot(v2) inner product of the two vectors") .def("dot", &Vec3_dot_Vec3Array,"v1.dot(v2) array inner product") .def("equalWithAbsError", &Vec3::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", &Vec3::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", &Vec3_length,"length() magnitude of the vector") .def("length2", &Vec3_length2,"length2() square magnitude of the vector") .def("normalize", &Vec3_normalize,return_internal_reference<>(), "v.normalize() destructively normalizes v and returns a reference to it") .def("normalizeExc", &Vec3_normalizeExc,return_internal_reference<>(), "v.normalizeExc() destructively normalizes V and returns a reference to it, throwing an exception if length() == 0") .def("normalizeNonNull", &Vec3_normalizeNonNull,return_internal_reference<>(), "v.normalizeNonNull() destructively normalizes V and returns a reference to it, faster if lngth() != 0") .def("normalized", &Vec3_normalized, "v.normalized() returns a normalized copy of v") .def("normalizedExc", &Vec3_normalizedExc, "v.normalizedExc() returns a normalized copy of v, throwing an exception if length() == 0") .def("normalizedNonNull", &Vec3_normalizedNonNull, "v.normalizedNonNull() returns a normalized copy of v, faster if lngth() != 0") .def("__len__", Vec3_helper::len) .def("__getitem__", Vec3_helper::getitem,return_value_policy()) .def("__setitem__", Vec3_helper::setitem) .def("closestVertex", &closestVertex) .def("negate", &Vec3_negate, return_internal_reference<>()) .def("orthogonal", &orthogonal) .def("project", &project) .def("reflect", &reflect) .def("setValue", &setValue) .def("__neg__", &Vec3_neg) .def("__mul__", &Vec3_mul) .def("__mul__", &Vec3_mul) .def("__mul__", &Vec3_mul) .def("__mul__", &Vec3_mulT) .def("__mul__", &Vec3_mulTArray) .def("__rmul__", &Vec3_rmulT) .def("__rmul__", &Vec3_rmulTArray) .def("__imul__", &Vec3_imulV,return_internal_reference<>()) .def("__imul__", &Vec3_imulV,return_internal_reference<>()) .def("__imul__", &Vec3_imulV,return_internal_reference<>()) .def("__imul__", &Vec3_imulT,return_internal_reference<>()) .def("__div__", &Vec3_Vec3_divT) .def("__truediv__", &Vec3_Vec3_divT) .def("__mul__", &Vec3_mulM33) .def("__mul__", &Vec3_mulM33) .def("__mul__", &Vec3_mulM44) .def("__mul__", &Vec3_mulM44) .def("__mul__", &Vec3_Vec3_mulT) .def("__div__", &Vec3_div) .def("__div__", &Vec3_div) .def("__div__", &Vec3_div) .def("__div__", &Vec3_divTuple) .def("__div__", &Vec3_divTuple) .def("__div__", &Vec3_divT) .def("__truediv__", &Vec3_div) .def("__truediv__", &Vec3_div) .def("__truediv__", &Vec3_div) .def("__truediv__", &Vec3_divTuple) .def("__truediv__", &Vec3_divTuple) .def("__truediv__", &Vec3_divT) .def("__rdiv__", &Vec3_rdivTuple) .def("__rdiv__", &Vec3_rdivTuple) .def("__rdiv__", &Vec3_rdivT) .def("__idiv__", &Vec3_idivObj,return_internal_reference<>()) .def("__itruediv__", &Vec3_idivObj,return_internal_reference<>()) .def("__xor__", &Vec3_dot) .def("__mod__", &Vec3_cross) .def(self == self) .def(self != self) .def("__add__", &Vec3_add) .def("__add__", &Vec3_addV) .def("__add__", &Vec3_addV) .def("__add__", &Vec3_addV) .def("__add__", &Vec3_addT) .def("__add__", &Vec3_addTuple) .def("__add__", &Vec3_addTuple) .def("__radd__", &Vec3_addT) .def("__radd__", &Vec3_addTuple) .def("__radd__", &Vec3_addTuple) .def("__radd__", &Vec3_add) .def("__iadd__", &Vec3_iaddV, return_internal_reference<>()) .def("__iadd__", &Vec3_iaddV, return_internal_reference<>()) .def("__iadd__", &Vec3_iaddV, return_internal_reference<>()) .def("__sub__", &Vec3_sub) .def("__sub__", &Vec3_subV) .def("__sub__", &Vec3_subV) .def("__sub__", &Vec3_subV) .def("__sub__", &Vec3_subT) .def("__sub__", &Vec3_subTuple) .def("__sub__", &Vec3_subTuple) .def("__rsub__", &Vec3_rsubT) .def("__rsub__", &Vec3_rsubTuple) .def("__rsub__", &Vec3_rsubTuple) .def("__isub__", &Vec3_isubV, return_internal_reference<>()) .def("__isub__", &Vec3_isubV, return_internal_reference<>()) .def("__isub__", &Vec3_isubV, return_internal_reference<>()) .def("__mul__", &mult) .def("__rmul__", &mult) .def("__imul__", &Vec3_imulM44, return_internal_reference<>()) .def("__imul__", &Vec3_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__",&Vec3_str) .def("__repr__",&Vec3_repr) ; decoratecopy(vec3_class); //add_swizzle3_operators(v3f_class); return vec3_class; } } // namespace PyImath #endif // _PyImathVec3Impl_h_