1 %typemap(in) float q[4] (float temp[4]) {
2     convert_SbVec4f_array($input, temp);
3     $1 = temp;
4 }
5 
6 %typemap(typecheck) float q[4] {
7     $1 = PySequence_Check($input) ? 1 : 0;
8 }
9 
10 %typemap(out) float * {
11   $result = Py_BuildValue("(ffff)",
12                           (double)(*($1)),
13                           (double)(*($1+1)),
14                           (double)(*($1+2)),
15                           (double)(*($1+3)));
16 }
17 
18 /* add operator overloading methods instead of the global functions */
19 %extend SbRotation {
__mul__(const SbRotation & u)20     SbRotation __mul__(const SbRotation &u) { return *self * u; }
__mul__(const double d)21     SbRotation __mul__(const double d) { SbRotation res(*self); return (res *= d); }
__mul__(const SbVec3f & v)22     SbVec3f __mul__(const SbVec3f & v) { SbVec3f res; self->multVec(v, res); return res; }
__eq__(const SbRotation & u)23     int __eq__(const SbRotation &u) { return *self == u; }
__nq__(const SbRotation & u)24     int __nq__(const SbRotation &u) { return *self != u; }
25 %pythoncode %{
26     def __imul__(self, other):
27         return self * other
28 %}
29 }
30 
31 %apply float * OUTPUT { float & q0, float & q1, float & q2, float & q3, float & radians};
32 
33 /* the next 2 typemaps handle the return value for getMatrix and getAxisAngle ~ getValue */
34 %typemap(in,numinputs=0) SbVec3f & axis, SbMatrix & matrix {
35     $1 = new $1_basetype();
36 }
37 %typemap(argout) SbVec3f & axis, SbMatrix & matrix {
38     $result = SWIG_NewPointerObj((void *) $1, $1_descriptor, 1);
39 }
40 /* undo effect of in typemap for setValue calls */
41 %typemap(in) const SbVec3f & axis = SWIGTYPE &;
42 %typemap(argout) const SbVec3f & axis {};
43 
44 %ignore SbRotation::getValue(float & q0, float & q1, float & q2, float & q3) const;
45 %rename(getAxisAngle) SbRotation::getValue(SbVec3f & axis, float & radians) const;
46 %rename(getMatrix) SbRotation::getValue(SbMatrix & matrix) const;
47