I have a vector class whose .h is:
class Vec3 {
public:
float x;
float y;
float z;
public:
Vec3():x(0.0),y(0.0),z(0.0) {}
Vec3(float X,float Y,float Z):x(X),y(Y),z(Z) {}
Vec3(const Vec3& v) {x=v[0];y=v[1];z=v[2];}
Vec3(const float v[]) {x=v[0];y=v[1];z=v[2];}
};
The corresponding SIP file is:
class Vec3 {
%TypeHeaderCode
#include "Vec3.h"
%End
public:
float x;
float y;
float z;
Vec3();
Vec3(float x,float y,float z);
Vec3(const Vec3& v2);
//Vec3(const float v2[]);
};
Two Issues:
1) I can't get the Vec(const float v[]) constructor to compile on SIP.
I assume that's because I can't pass a pointer from Python?
So, perhaps the answer is there is no equivalent for this on the
python side, so leaving this out of the sip file is correct. But then,
2) What I really want is to be able to say on the python side is:
from Vec3 import *
t = (1,2,3) # or t = [1,2,3]
v = Vec3(t)
I'm confused as to how to go about this, as I can't declare a type
Tuple in a C++ declaration. Any help would be appreciated.
Thanks - jamie
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt