Skip to content
Snippets Groups Projects
Commit 303797b4 authored by Marco Biasini's avatar Marco Biasini
Browse files

silence strict aliasing warning

parent 62b02e58
Branches
Tags
No related merge requests found
......@@ -48,11 +48,11 @@ Mat3 Vec3List::GetInertia() const
Mat3 Vec3List::GetPrincipalAxes() const
{
Mat3 inertia=this->GetInertia();
EMat3 inertia_mat(*reinterpret_cast<EMat3*>(&inertia));
EMat3 inertia_mat(inertia.Data());
Eigen::SVD<EMat3> svd(inertia_mat);
EMat3 rot=svd.matrixU();
Mat3 axes(*reinterpret_cast<Mat3*>(&rot));
Mat3 axes(rot.data());
return axes;
}
......
......@@ -35,26 +35,26 @@ typedef Eigen::Matrix<Real, Eigen::Dynamic, 3> EMatX3;
inline geom::Vec3 rvec_to_gvec(const ERVec3 &vec) {
return *reinterpret_cast<const geom::Vec3*>(&vec);
return geom::Vec3(vec.data());
}
inline geom::Vec3 cvec_to_gvec(const ECVec3 &vec) {
return *reinterpret_cast<const geom::Vec3*>(&vec);
return geom::Vec3(vec.data());
}
inline geom::Mat3 emat_to_gmat(const EMat3 &mat)
{
return *reinterpret_cast<const geom::Mat3*>(&mat);
return geom::Mat3(mat.data());
}
inline ERVec3 gvec_to_rvec(const geom::Vec3 &vec)
{
return *reinterpret_cast<const ERVec3*>(&vec);
return ERVec3(&vec[0]);
}
inline ECVec3 gvec_to_cvec(const geom::Vec3 &vec)
{
return *reinterpret_cast<const ECVec3*>(&vec);
return ECVec3(&vec[0]);
}
inline EMat3X row_sub(const EMat3X& m, const ERVec3& s)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment