Skip to content
Snippets Groups Projects
Commit de0932e9 authored by ansgar's avatar ansgar
Browse files

added Bond::GetOther convenience method

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@1922 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 6699d377
Branches
Tags
No related merge requests found
......@@ -41,6 +41,8 @@ void export_Bond()
make_function(&BondHandle::GetFirst))
.add_property("second",
make_function(&BondHandle::GetSecond))
.add_property("other",
make_function(&BondHandle::GetOther))
.add_property("length",
&BondHandle::GetLength)
.add_property("bond_order",
......@@ -48,6 +50,7 @@ void export_Bond()
&BondHandle::SetBondOrder)
.def("GetFirst", &BondHandle::GetFirst)
.def("GetSecond",&BondHandle::GetSecond)
.def("GetOther",&BondHandle::GetOther)
.def("GetLength",&BondHandle::GetLength)
.def("GetBondOrder",&BondHandle::GetBondOrder)
.def("SetBondOrder",&BondHandle::SetBondOrder)
......
......@@ -64,6 +64,20 @@ AtomHandle BondHandle::GetSecond() const
return nrvo;
}
AtomHandle BondHandle::GetOther(const AtomHandle& a) const
{
this->CheckValidity();
if(a.IsValid()) {
if(a.Impl()==impl_->GetFirst()) {
return GetSecond();
} else {
return GetFirst();
}
}
AtomHandle nrvo(impl_->GetFirst());
return nrvo;
}
geom::Vec3 BondHandle::GetPos() const
{
this->CheckValidity();
......
......@@ -73,6 +73,11 @@ public:
/// \brief get second atom
/// In python also available as the property second
AtomHandle GetSecond() const;
/// \brief get other atom
/// Returns one of the two atoms that does not match the given one.
/// In python also available as the property other
AtomHandle GetOther(const AtomHandle& a) const;
//@}
/// \brief return midpoint between the two atoms (transformed coordinates)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment