summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/avogadro-python-eigen-lib.patch
blob: ac9f2e30aff26ab2837e9f2231c3a72e59e284c0 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
From 2d4be7ede177a8df7340fe3b209698d591ee8a04 Mon Sep 17 00:00:00 2001
From: Claudio Fernandes <claudiosf.claudio@gmail.com>
Date: Mon, 16 Jan 2017 19:48:23 -0200
Subject: [PATCH] Adapt libavogadro/python to Eigen 3.3

---
 libavogadro/src/python/camera.cpp |  2 +-
 libavogadro/src/python/eigen.cpp  | 60 +++++++++++++++++++--------------------
 2 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/libavogadro/src/python/camera.cpp b/libavogadro/src/python/camera.cpp
index 69ca87bf8..30b32af7d 100644
--- a/libavogadro/src/python/camera.cpp
+++ b/libavogadro/src/python/camera.cpp
@@ -10,7 +10,7 @@ using namespace Avogadro;
 void export_Camera()
 {
 
-  const Eigen::Transform3d& (Camera::*modelview_ptr)() const = &Camera::modelview;
+  const Eigen::Projective3d& (Camera::*modelview_ptr)() const = &Camera::modelview;
   Eigen::Vector3d (Camera::*unProject_ptr1)(const Eigen::Vector3d&) const = &Camera::unProject;
   Eigen::Vector3d (Camera::*unProject_ptr2)(const QPoint&, const Eigen::Vector3d&) const = &Camera::unProject;
   Eigen::Vector3d (Camera::*unProject_ptr3)(const QPoint&) const = &Camera::unProject;
diff --git a/libavogadro/src/python/eigen.cpp b/libavogadro/src/python/eigen.cpp
index c1faedbcc..20b4e719d 100644
--- a/libavogadro/src/python/eigen.cpp
+++ b/libavogadro/src/python/eigen.cpp
@@ -305,9 +305,9 @@ template <> struct ScalarTraits<double>
     struct innerclass
     {
       //
-      //  Eigen::Transform3d --> python array (4x4)
+      //  Eigen::Projective3d --> python array (4x4)
       //
-      static PyObject* convert(Eigen::Transform3d const &trans)
+      static PyObject* convert(Eigen::Projective3d const &trans)
       {
         npy_intp dims[2] = { 4, 4 };
         PyObject *result = PyArray_SimpleNew(2, dims, PyArray_DOUBLE);
@@ -321,9 +321,9 @@ template <> struct ScalarTraits<double>
         return incref(result);
       }
       //
-      //  Eigen::Transform3d* --> python array (4x4)
+      //  Eigen::Projective3d* --> python array (4x4)
       //
-      static PyObject* convert(Eigen::Transform3d *trans)
+      static PyObject* convert(Eigen::Projective3d *trans)
       {
         npy_intp dims[2] = { 4, 4 };
         PyObject *result = PyArray_SimpleNew(2, dims, PyArray_DOUBLE);
@@ -337,9 +337,9 @@ template <> struct ScalarTraits<double>
         return incref(result);
       }
       //
-      //  const Eigen::Transform3d* --> python array (4x4)
+      //  const Eigen::Projective3d* --> python array (4x4)
       //
-      static PyObject* convert(const Eigen::Transform3d *trans)
+      static PyObject* convert(const Eigen::Projective3d *trans)
       {
         npy_intp dims[2] = { 4, 4 };
         PyObject *result = PyArray_SimpleNew(2, dims, PyArray_DOUBLE);
@@ -358,10 +358,10 @@ template <> struct ScalarTraits<double>
     Transform3d_to_python_array()
     {
       #ifndef WIN32
-      to_python_converter<Eigen::Transform3d, innerclass>();
+      to_python_converter<Eigen::Projective3d, innerclass>();
       #endif
-      to_python_converter<Eigen::Transform3d*, innerclass>();
-      to_python_converter<const Eigen::Transform3d*, innerclass>();
+      to_python_converter<Eigen::Projective3d*, innerclass>();
+      to_python_converter<const Eigen::Projective3d*, innerclass>();
     }
 
   };
@@ -373,17 +373,17 @@ template <> struct ScalarTraits<double>
       // Insert an rvalue from_python converter at the tail of the
       // chain. Used for implicit conversions
       //
-      //  python array --> Eigen::Transform3d
+      //  python array --> Eigen::Projective3d
       //
       // used for:
       //
-      //  void function(Eigen::Transform3d vec)
-      //  void function(Eigen::Transform3d & vec)
-      //  void function(const Eigen::Transform3d & vec)
+      //  void function(Eigen::Projective3d vec)
+      //  void function(Eigen::Projective3d & vec)
+      //  void function(const Eigen::Projective3d & vec)
       //
-      converter::registry::push_back( &convertible, &construct, type_id<Eigen::Transform3d>() );
+      converter::registry::push_back( &convertible, &construct, type_id<Eigen::Projective3d>() );
       
-      converter::registry::insert( &convert, type_id<Eigen::Transform3d>() );
+      converter::registry::insert( &convert, type_id<Eigen::Projective3d>() );
     }
 
     static void* convert(PyObject *obj_ptr)
@@ -401,7 +401,7 @@ template <> struct ScalarTraits<double>
         throw_error_already_set(); // the 1D array does not have exactly 3 elements
 
       double *values = reinterpret_cast<double*>(array->data);
-      Eigen::Transform3d *c_obj = new Eigen::Transform3d();
+      Eigen::Projective3d *c_obj = new Eigen::Projective3d();
       double *dataPtr = c_obj->data();
 
       for (int i = 0; i < 16; ++i)
@@ -432,7 +432,7 @@ template <> struct ScalarTraits<double>
       // I think this is a better way to get at the double array, where is this
       // deleted though? Does Boost::Python do it?
       double *values = reinterpret_cast<double*>(array->data);
-      Eigen::Transform3d *storage = new Eigen::Transform3d();
+      Eigen::Projective3d *storage = new Eigen::Projective3d();
       double *dataPtr = storage->data();
 
       for (int i = 0; i < 16; ++i)
@@ -467,21 +467,21 @@ class EigenUnitTestHelper
     void set_vector3d_ptr(Eigen::Vector3d* vec)                 { m_vector3d = *vec; }
     void set_const_vector3d_ptr(const Eigen::Vector3d* const vec) { m_vector3d = *vec; }
 
-    //Eigen::Transform3d             transform3d()              { return m_transform3d; }
-    //Eigen::Transform3d&            transform3d_ref()          { return m_transform3d; }
-    const Eigen::Transform3d&      const_transform3d_ref()    { return m_transform3d; }
-    Eigen::Transform3d*            transform3d_ptr()          { return &m_transform3d; }
-    const Eigen::Transform3d*      const_transform3d_ptr()    { return &m_transform3d; }
-
-    //void set_transform3d(Eigen::Transform3d vec)                      { m_transform3d = vec; }
-    //void set_transform3d_ref(Eigen::Transform3d& vec)                 { m_transform3d = vec; }
-    void set_const_transform3d_ref(const Eigen::Transform3d& vec)     { m_transform3d = vec; }
-    void set_transform3d_ptr(Eigen::Transform3d* vec)                 { m_transform3d = *vec; }
-    void set_const_transform3d_ptr(const Eigen::Transform3d* const vec) { m_transform3d = *vec; }
+    //Eigen::Projective3d             transform3d()              { return m_transform3d; }
+    //Eigen::Projective3d&            transform3d_ref()          { return m_transform3d; }
+    const Eigen::Projective3d&      const_transform3d_ref()    { return m_transform3d; }
+    Eigen::Projective3d*            transform3d_ptr()          { return &m_transform3d; }
+    const Eigen::Projective3d*      const_transform3d_ptr()    { return &m_transform3d; }
+
+    //void set_transform3d(Eigen::Projective3d vec)                      { m_transform3d = vec; }
+    //void set_transform3d_ref(Eigen::Projective3d& vec)                 { m_transform3d = vec; }
+    void set_const_transform3d_ref(const Eigen::Projective3d& vec)     { m_transform3d = vec; }
+    void set_transform3d_ptr(Eigen::Projective3d* vec)                 { m_transform3d = *vec; }
+    void set_const_transform3d_ptr(const Eigen::Projective3d* const vec) { m_transform3d = *vec; }
  
   private:
     Eigen::Vector3d m_vector3d;
-    Eigen::Transform3d m_transform3d;
+    Eigen::Projective3d m_transform3d;
 
 };
 #endif
@@ -529,6 +529,6 @@ void export_Eigen()
   Vector3x_to_python_array<Eigen::Vector3i>();
   Vector3x_from_python_array<Eigen::Vector3i>();
 
-  // Eigen::Transform3d
+  // Eigen::Projective3d
   Transform3d_to_python_array();
   Transform3d_from_python_array();