00001
00002
00003
00004 #ifndef BASE_VECTORPY_H
00005 #define BASE_VECTORPY_H
00006
00007 #include <Base/PyObjectBase.h>
00008 #include <Base/Vector3D.h>
00009 #include <string>
00010
00011 namespace Base
00012 {
00013
00014
00015
00016
00017
00020 class BaseExport VectorPy : public Base::PyObjectBase
00021 {
00022 public:
00023 static PyTypeObject Type;
00024 static PyMethodDef Methods[];
00025 static PyNumberMethods Number[];
00026 static PySequenceMethods Sequence[];
00027 static PyObject * richCompare(PyObject *v, PyObject *w, int op);
00028 static PyGetSetDef GetterSetter[];
00029 static PyParentObject Parents[];
00030 virtual PyTypeObject *GetType(void) {return &Type;};
00031 virtual PyParentObject *GetParents(void) {return Parents;}
00032
00033 public:
00034 VectorPy(Vector3d *pcObject, PyTypeObject *T = &Type);
00035 static PyObject *PyMake(struct _typeobject *, PyObject *, PyObject *);
00036 virtual int PyInit(PyObject* args, PyObject*k);
00037 ~VectorPy();
00038
00039 typedef Vector3d* PointerType ;
00040
00041 virtual PyObject *_repr(void);
00042 std::string representation(void) const;
00043
00046
00047 static PyObject * staticCallback_add (PyObject *self, PyObject *args);
00049 PyObject* add(PyObject *args);
00051 static PyObject * staticCallback_sub (PyObject *self, PyObject *args);
00053 PyObject* sub(PyObject *args);
00055 static PyObject * staticCallback_scale (PyObject *self, PyObject *args);
00057 PyObject* scale(PyObject *args);
00059 static PyObject * staticCallback_multiply (PyObject *self, PyObject *args);
00061 PyObject* multiply(PyObject *args);
00063 static PyObject * staticCallback_dot (PyObject *self, PyObject *args);
00065 PyObject* dot(PyObject *args);
00067 static PyObject * staticCallback_cross (PyObject *self, PyObject *args);
00069 PyObject* cross(PyObject *args);
00071 static PyObject * staticCallback_getAngle (PyObject *self, PyObject *args);
00073 PyObject* getAngle(PyObject *args);
00075 static PyObject * staticCallback_normalize (PyObject *self, PyObject *args);
00077 PyObject* normalize(PyObject *args);
00079 static PyObject * staticCallback_projectToLine (PyObject *self, PyObject *args);
00081 PyObject* projectToLine(PyObject *args);
00083 static PyObject * staticCallback_projectToPlane (PyObject *self, PyObject *args);
00085 PyObject* projectToPlane(PyObject *args);
00087 static PyObject * staticCallback_distanceToLine (PyObject *self, PyObject *args);
00089 PyObject* distanceToLine(PyObject *args);
00091 static PyObject * staticCallback_distanceToPlane (PyObject *self, PyObject *args);
00093 PyObject* distanceToPlane(PyObject *args);
00095
00098
00099 static PyObject * number_add_handler (PyObject *self, PyObject *other);
00101 static PyObject * number_subtract_handler (PyObject *self, PyObject *other);
00103 static PyObject * number_multiply_handler (PyObject *self, PyObject *other);
00105
00107 static Py_ssize_t sequence_length(PyObject *);
00108 static PyObject * sequence_item(PyObject *, Py_ssize_t);
00109 static int sequence_ass_item(PyObject *, Py_ssize_t, PyObject *);
00111
00114
00115 static PyObject * staticCallback_getLength (PyObject *self, void *closure);
00117 Py::Float getLength(void) const;
00119 static int staticCallback_setLength (PyObject *self, PyObject *value, void *closure);
00121 void setLength(Py::Float arg);
00123 static PyObject * staticCallback_getx (PyObject *self, void *closure);
00125 Py::Float getx(void) const;
00127 static int staticCallback_setx (PyObject *self, PyObject *value, void *closure);
00129 void setx(Py::Float arg);
00131 static PyObject * staticCallback_gety (PyObject *self, void *closure);
00133 Py::Float gety(void) const;
00135 static int staticCallback_sety (PyObject *self, PyObject *value, void *closure);
00137 void sety(Py::Float arg);
00139 static PyObject * staticCallback_getz (PyObject *self, void *closure);
00141 Py::Float getz(void) const;
00143 static int staticCallback_setz (PyObject *self, PyObject *value, void *closure);
00145 void setz(Py::Float arg);
00147
00149 PyObject *getCustomAttributes(const char* attr) const;
00151 int setCustomAttributes(const char* attr, PyObject *obj);
00152 PyObject *_getattr(char *attr);
00153 int _setattr(char *attr, PyObject *value);
00154
00156 Vector3d *getVectorPtr(void) const;
00157
00160 public:
00161 VectorPy(const Vector3d & vec, PyTypeObject *T = &Type)
00162 :PyObjectBase(new Vector3d(vec),T){}
00163 VectorPy(const Vector3f & vec, PyTypeObject *T = &Type)
00164 :PyObjectBase(new Vector3d(vec.x,vec.y,vec.z),T){}
00165 Vector3d value() const
00166 { return *(getVectorPtr()); }
00167
00169 };
00170
00171 #define PARENTSBaseVectorPy &VectorPy::Type,PARENTSBasePyObjectBase
00172
00173 }
00174
00175 #endif // BASE_VECTORPY_H
00176
00177