Commit faa9cd04 by Maarten L. Hekkelman

Added another rotate/translate method to mmcif::Structure

parent e0c3c239
......@@ -165,6 +165,9 @@ class Atom
/// \brief Translate and rotate the position of this atom by \a t and \a q
void translateAndRotate(Point t, Quaternion q);
/// \brief Translate, rotate and translate again the coordinates this atom by \a t1 , \a q and \a t2
void translateRotateAndTranslate(Point t1, Quaternion q, Point t2);
// for direct access to underlying data, be careful!
const cif::Row getRow() const { return mImpl->mRow; }
const cif::Row getRowAniso() const;
......@@ -609,6 +612,9 @@ class Structure
/// \brief Translate and rotate the coordinates of all atoms in the structure by \a t and \a q
void translateAndRotate(Point t, Quaternion q);
/// \brief Translate, rotate and translate again the coordinates of all atoms in the structure by \a t1 , \a q and \a t2
void translateRotateAndTranslate(Point t1, Quaternion q, Point t2);
const std::vector<Residue> &getNonPolymers() const { return mNonPolymers; }
const std::vector<Residue> &getBranchResidues() const { return mBranchResidues; }
......
......@@ -458,6 +458,15 @@ void Atom::translateAndRotate(Point t, Quaternion q)
location(loc);
}
void Atom::translateRotateAndTranslate(Point t1, Quaternion q, Point t2)
{
auto loc = location();
loc += t1;
loc.rotate(q);
loc += t2;
location(loc);
}
bool Atom::operator==(const Atom &rhs) const
{
return mImpl == rhs.mImpl or
......@@ -2198,4 +2207,10 @@ void Structure::translateAndRotate(Point t, Quaternion q)
a.translateAndRotate(t, q);
}
void Structure::translateRotateAndTranslate(Point t1, Quaternion q, Point t2)
{
for (auto &a : mAtoms)
a.translateRotateAndTranslate(t1, q, t2);
}
} // namespace mmcif
......@@ -179,3 +179,23 @@ _struct_asym.details ?
<< structure.getFile().data() << std::endl;
}
}
// // --------------------------------------------------------------------
// BOOST_AUTO_TEST_CASE(test_load_1)
// {
// mmcif::File cf(gTestDir / "5v3g.cif.gz");
// mmcif::Structure s(cf);
// for (auto &poly : s.polymers())
// {
// std::cout << std::string(80, '=') << std::endl;
// for (auto &res : poly)
// {
// std::cout << res << std::endl;
// for (auto &atom : res.atoms())
// std::cout << " " << atom << std::endl;
// }
// }
// }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment