12 #define HBOOST_BIND_GLOBAL_PLACEHOLDERS
13 #include <hboost/python.hpp>
20 template <
class T> hboost::python::class_<IMATH_NAMESPACE::Vec2<T> >
register_Vec2();
21 template <
class T> hboost::python::class_<FixedArray<IMATH_NAMESPACE::Vec2<T> > >
register_Vec2Array();
65 template <
class T> hboost::python::class_<IMATH_NAMESPACE::Vec3<T> >
register_Vec3();
66 template <
class T> hboost::python::class_<FixedArray<IMATH_NAMESPACE::Vec3<T> > >
register_Vec3Array();
120 template <
class T> hboost::python::class_<IMATH_NAMESPACE::Vec4<T> >
register_Vec4();
121 template <
class T> hboost::python::class_<PyImath::FixedArray<IMATH_NAMESPACE::Vec4<T> > >
register_Vec4Array();
189 static PyObject *
wrap (
const IMATH_NAMESPACE::Vec2<T> &
v);
190 static int convert (PyObject *p, IMATH_NAMESPACE::Vec2<T> *v);
196 static PyObject *
wrap (
const IMATH_NAMESPACE::Vec3<T> &
v);
197 static int convert (PyObject *p, IMATH_NAMESPACE::Vec3<T> *v);
203 static PyObject *
wrap (
const IMATH_NAMESPACE::Vec4<T> &
v);
204 static int convert (PyObject *p, IMATH_NAMESPACE::Vec4<T> *v);
211 typename hboost::python::return_by_value::apply < IMATH_NAMESPACE::Vec2<T> >
::type converter;
212 PyObject *p = converter (v);
220 typename hboost::python::return_by_value::apply < IMATH_NAMESPACE::Vec3<T> >
::type converter;
221 PyObject *p = converter (v);
229 typename hboost::python::return_by_value::apply < IMATH_NAMESPACE::Vec4<T> >
::type converter;
230 PyObject *p = converter (v);
238 hboost::python::extract <IMATH_NAMESPACE::V2i> extractorV2i (p);
239 if (extractorV2i.check())
242 v->setValue (
T(v2i[0]),
T(v2i[1]));
246 hboost::python::extract <IMATH_NAMESPACE::V2i64> extractorV2i64 (p);
247 if (extractorV2i64.check())
250 v->setValue (
T(v2i64[0]),
T(v2i64[1]));
254 hboost::python::extract <IMATH_NAMESPACE::V2f> extractorV2f (p);
255 if (extractorV2f.check())
258 v->setValue (
T(v2f[0]),
T(v2f[1]));
262 hboost::python::extract <IMATH_NAMESPACE::V2d> extractorV2d (p);
263 if (extractorV2d.check())
266 v->setValue (
T(v2d[0]),
T(v2d[1]));
270 hboost::python::extract <hboost::python::tuple> extractorTuple (p);
271 if (extractorTuple.check())
273 hboost::python::tuple
t = extractorTuple();
274 if (t.attr (
"__len__") () == 2)
284 double a = hboost::python::extract <double> (t[0]);
285 double b = hboost::python::extract <double> (t[1]);
286 v->setValue (
T(a),
T(b));
291 hboost::python::extract <hboost::python::list> extractorList (p);
292 if (extractorList.check())
294 hboost::python::list l = extractorList();
295 if (l.attr (
"__len__") () == 2)
297 hboost::python::extract <double> extractor0 (l[0]);
298 hboost::python::extract <double> extractor1 (l[1]);
299 if (extractor0.check() && extractor1.check())
301 v->setValue (
T(extractor0()),
T(extractor1()));
314 hboost::python::extract <IMATH_NAMESPACE::V3i> extractorV3i (p);
315 if (extractorV3i.check())
318 v->setValue (
T(v3i[0]),
T(v3i[1]),
T(v3i[2]));
322 hboost::python::extract <IMATH_NAMESPACE::V3i64> extractorV3i64 (p);
323 if (extractorV3i64.check())
326 v->setValue (
T(v3i64[0]),
T(v3i64[1]),
T(v3i64[2]));
330 hboost::python::extract <IMATH_NAMESPACE::V3f> extractorV3f (p);
331 if (extractorV3f.check())
334 v->setValue (
T(v3f[0]),
T(v3f[1]),
T(v3f[2]));
338 hboost::python::extract <IMATH_NAMESPACE::V3d> extractorV3d (p);
339 if (extractorV3d.check())
342 v->setValue (
T(v3d[0]),
T(v3d[1]),
T(v3d[2]));
346 hboost::python::extract <hboost::python::tuple> extractorTuple (p);
347 if (extractorTuple.check())
349 hboost::python::tuple
t = extractorTuple();
350 if (t.attr (
"__len__") () == 3)
354 double a = hboost::python::extract <double> (t[0]);
355 double b = hboost::python::extract <double> (t[1]);
356 double c = hboost::python::extract <double> (t[2]);
357 v->setValue (
T(a),
T(b),
T(c));
362 hboost::python::extract <hboost::python::list> extractorList (p);
363 if (extractorList.check())
365 hboost::python::list l = extractorList();
366 if (l.attr (
"__len__") () == 3)
368 hboost::python::extract <double> extractor0 (l[0]);
369 hboost::python::extract <double> extractor1 (l[1]);
370 hboost::python::extract <double> extractor2 (l[2]);
371 if (extractor0.check() && extractor1.check() &&
374 v->setValue (
T(extractor0()),
T(extractor1()),
388 hboost::python::extract <IMATH_NAMESPACE::V4i> extractorV4i (p);
389 if (extractorV4i.check())
392 *v = IMATH_NAMESPACE::Vec4<T>(v4i);
396 hboost::python::extract <IMATH_NAMESPACE::V4f> extractorV4f (p);
397 if (extractorV4f.check())
400 *v = IMATH_NAMESPACE::Vec4<T>(v4f);
404 hboost::python::extract <IMATH_NAMESPACE::V4d> extractorV4d (p);
405 if (extractorV4d.check())
408 *v = IMATH_NAMESPACE::Vec4<T>(v4d);
412 hboost::python::extract <hboost::python::tuple> extractorTuple (p);
413 if (extractorTuple.check())
415 hboost::python::tuple
t = extractorTuple();
416 if (t.attr (
"__len__") () == 4)
420 double a = hboost::python::extract <double> (t[0]);
421 double b = hboost::python::extract <double> (t[1]);
422 double c = hboost::python::extract <double> (t[2]);
423 double d = hboost::python::extract <double> (t[3]);
424 *v = IMATH_NAMESPACE::Vec4<T>(
T(a),
T(b),
T(c),
T(d));
429 hboost::python::extract <hboost::python::list> extractorList (p);
430 if (extractorList.check())
432 hboost::python::list l = extractorList();
433 if (l.attr (
"__len__") () == 4)
435 hboost::python::extract <double> extractor0 (l[0]);
436 hboost::python::extract <double> extractor1 (l[1]);
437 hboost::python::extract <double> extractor2 (l[2]);
438 hboost::python::extract <double> extractor3 (l[3]);
439 if (extractor0.check() && extractor1.check() &&
440 extractor2.check() && extractor3.check())
442 *v = IMATH_NAMESPACE::Vec4<T>(
T(extractor0()),
T(extractor1()),
443 T(extractor2()),
T(extractor3()));
FixedArray< IMATH_NAMESPACE::V3i > V3iArray
Mat3< typename promote< S, T >::type > operator*(S scalar, const Mat3< T > &m)
Multiply each element of the given matrix by scalar and return the result.
hboost::python::class_< PyImath::FixedArray< IMATH_NAMESPACE::Vec4< T > > > register_Vec4Array()
FixedArray< IMATH_NAMESPACE::Vec4< unsigned char > > V4cArray
Matrix44< float > M44f
4x4 matrix of float
FixedArray< IMATH_NAMESPACE::V3f > V3fArray
Vec4< float > V4f
Vec4 of float.
Vec3< int > V3i
Vec3 of integer.
Vec2< int > V2i
Vec2 of integer.
FixedArray< IMATH_NAMESPACE::V4i64 > V4i64Array
GLboolean GLboolean GLboolean GLboolean a
static PyObject * wrap(const IMATH_NAMESPACE::Vec4< T > &v)
hboost::python::class_< IMATH_NAMESPACE::Vec2< T > > register_Vec2()
hboost::python::class_< FixedArray< IMATH_NAMESPACE::Vec3< T > > > register_Vec3Array()
static PyObject * wrap(const IMATH_NAMESPACE::Vec3< T > &v)
Vec4< int > V4i
Vec4 of integer.
FixedArray< IMATH_NAMESPACE::V4s > V4sArray
hboost::python::class_< IMATH_NAMESPACE::Vec3< T > > register_Vec3()
FixedArray< IMATH_NAMESPACE::V3s > V3sArray
Matrix44< double > M44d
4x4 matrix of double
Vec3< double > V3d
Vec3 of double.
static PyObject * wrap(const IMATH_NAMESPACE::Vec2< T > &v)
GLint GLint GLsizei GLint GLenum GLenum type
hboost::python::class_< FixedArray< IMATH_NAMESPACE::Vec2< T > > > register_Vec2Array()
hboost::python::class_< IMATH_NAMESPACE::Vec4< T > > register_Vec4()
FixedArray< IMATH_NAMESPACE::V2i > V2iArray
FixedArray< IMATH_NAMESPACE::V3d > V3dArray
Vec2< double > V2d
Vec2 of double.
Vec3< int64_t > V3i64
Vec3 of int64_t.
static int convert(PyObject *p, IMATH_NAMESPACE::Vec4< T > *v)
FixedArray< IMATH_NAMESPACE::V2f > V2fArray
FixedArray< IMATH_NAMESPACE::V2s > V2sArray
GLboolean GLboolean GLboolean b
Vec2< float > V2f
Vec2 of float.
FixedArray< IMATH_NAMESPACE::Vec3< unsigned char > > V3cArray
Vec3< float > V3f
Vec3 of float.
FixedArray< IMATH_NAMESPACE::V2d > V2dArray
#define PY_IMATH_LEAVE_PYTHON
FixedArray< IMATH_NAMESPACE::V4i > V4iArray
Vec2< int64_t > V2i64
Vec2 of int64_t.
FixedArray< IMATH_NAMESPACE::V3i64 > V3i64Array
FixedArray< IMATH_NAMESPACE::V4d > V4dArray
static int convert(PyObject *p, IMATH_NAMESPACE::Vec3< T > *v)
FixedArray< IMATH_NAMESPACE::V2i64 > V2i64Array
static int convert(PyObject *p, IMATH_NAMESPACE::Vec2< T > *v)
FixedArray< IMATH_NAMESPACE::V4f > V4fArray
Vec4< double > V4d
Vec4 of double.