Open ahundt opened 6 years ago
You'd need to do 2 things:
c_eigen.pxd
to declare Eigen::Transform<T, dim. mode>
and the operations you want to access and typedef for Affine3d
(you could also just declare the Affine3d
class and the functions you want but doing so with Transform
is the better solution)generate_eigen_pyx.py
that writes the binding for a specific instance of Transform (e.g. Affine3d
) and append that output to the generated eigen.pyx
(around L. 668)eigen.pxd
(also generated, around L. 686 of generate_eigen_pyx.py
)Note: for the declaration of mode
you'll want to do something similar to the way dynamic
, one
, two
, three
, four
and six
are defined but using Eigen's nameds instead, e.g.
ctypedef int Affine "Affine"
I think @haudren tried this or something related in the past as well (but I might be remembering wrong)
@gergondet : Yes I tried to use those things in the past, but it was in a bit more complex situation.
Here you are in a typical "bind an enum" case. Thus you can use any of the following things:
cdef extern int one "eins", two "zwei"
cdef extern float three "drei"
cdef struct spam "SPAM":
int i "eye"
cdef enum surprise "inquisition":
first "alpha"
second "beta" = 3
(taken from here )
I would recommend going with the third style, as it neatly maps the Python from the C++ (and nobody expects the Spanish inquisition). Note that the enum
style automatically assumes that the values are int
s.
I'm thinking of adding Eigen::Affine3d https://github.com/RLovelett/eigen/blob/master/Eigen/src/Geometry/Transform.h to this, could you advise me on where I'll need to make changes?