I have a class that finds the convex hull of a 2D set of points. It contains a struct which has 2 Eigen::Matrix<double, 2, 1>
inside. It looks like this (with many things removed):
class Foo{
public:
Foo(Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>);
private:
struct edge{
unsigned int a;
unsigned int b;
Eigen::Matrix<double, 2, 1> slope;
double mag;
Eigen::Matrix<double, 2, 1> normal;
std::vector<unsigned int> list;
};
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> points;
std::vector<edge> edges
};
I am getting an assertion error when adding edges to the vector edges
like this:
void Foo::DoThing(){
edges.push_back(edge());
}
The exact error is:
Assertion failed: (reinterpret_cast(array) & 0xf) == 0 && "this assertio n is explained here: " "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalign edArrayAssert.html" " **** READ THIS WEB PAGE !!! ****", file \blah\blah\blah\includes\eigen\eigen-eigen-dc6cfdf9bcec\eigen\src\core\densestorage.h, line 86
I went to the webpage and read that I needed to add this macro:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
which I added to the struct as follows:
struct edge{
unsigned int a;
unsigned int b;
Eigen::Matrix<double, 2, 1> slope;
double mag;
Eigen::Matrix<double, 2, 1> normal;
std::vector<unsigned int> list;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
But the error continues. This is happening with VS 2013 and with Eigen version 3.2.9. The same code unmodified works fine with version 3.2.0. On linux with GCC version 5.3 it works fine with a beta build of Eigen. What am I doing wrong with this newer version to cause this problem?