bullet.pxd:
cdef extern from "bullet/LinearMath/btVector3.h":
cdef cppclass btVector3:
btVector3(float, float, float) except +
btVector3 operator+(const btVector3&, const btVector3&)
btmath.pyx:
cimport bullet as bt
cdef class Vector:
cdef bt.btVector3* _this
def __cinit__(self, float x=0, float y=0, float z=0):
self._this = new bt.btVector3(x, y, z)
def __add__(Vector self, Vector other):
vec = Vector()
del vec._this
vec._this[0] = self._this[0] + other._this[0]
return vec
The prototype of operator+ in btVector3.h:
SIMD_FORCE_INLINE btVector3
operator+(const btVector3& v1, const btVector3& v2);
As stated in the title, I get "Invalid operand types for '+' (btVector3; btVector3)". I'm guessing it has something to with how Cython deals with pass by reference, maybe?
Any help would be greatly appreciated.