Skip to content
Snippets Groups Projects
Commit 851cd4e7 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

GDT function for Vec3List

parent dded2583
No related branches found
No related tags found
No related merge requests found
...@@ -126,5 +126,6 @@ void export_Vec3() ...@@ -126,5 +126,6 @@ void export_Vec3()
.def("GetRMSD", &Vec3List::GetRMSD,(arg("other"))) .def("GetRMSD", &Vec3List::GetRMSD,(arg("other")))
.def("GetGDTHA", &Vec3List::GetGDTHA, (arg("other"), arg("norm")=true)) .def("GetGDTHA", &Vec3List::GetGDTHA, (arg("other"), arg("norm")=true))
.def("GetGDTTS", &Vec3List::GetGDTTS, (arg("other"), arg("norm")=true)) .def("GetGDTTS", &Vec3List::GetGDTTS, (arg("other"), arg("norm")=true))
.def("GetGDT", &Vec3List::GetGDT, (arg("other"), arg("thresh"), arg("norm")=true))
; ;
} }
...@@ -181,6 +181,23 @@ Real Vec3List::GetGDTTS(const Vec3List& other, bool norm) const ...@@ -181,6 +181,23 @@ Real Vec3List::GetGDTTS(const Vec3List& other, bool norm) const
return norm && !this->empty() ? static_cast<Real>(n)/(this->size()*4) : n; return norm && !this->empty() ? static_cast<Real>(n)/(this->size()*4) : n;
} }
Real Vec3List::GetGDT(const Vec3List& other, Real thresh, bool norm) const
{
if(this->size() != other.size()) {
String m = "Inconsistent sizes in Vec3List::GetNWithin";
throw GeomException(m);
}
int n = 0;
Real squared_thresh = thresh * thresh;
for(uint i = 0; i < this->size(); ++i) {
Real squared_d = geom::Length2((*this)[i] - other[i]);
if(squared_d < squared_thresh) {
++n;
}
}
return norm && !this->empty() ? static_cast<Real>(n)/(this->size()) : n;
}
std::pair<Line3, Real> Vec3List::FitCylinder(const Vec3& initial_direction) const std::pair<Line3, Real> Vec3List::FitCylinder(const Vec3& initial_direction) const
{ {
Vec3 center=this->GetCenter(); Vec3 center=this->GetCenter();
......
...@@ -342,6 +342,7 @@ public: ...@@ -342,6 +342,7 @@ public:
Real GetRMSD(const Vec3List& other) const; Real GetRMSD(const Vec3List& other) const;
Real GetGDTHA(const Vec3List& other, bool norm=true) const; Real GetGDTHA(const Vec3List& other, bool norm=true) const;
Real GetGDTTS(const Vec3List& other, bool norm=true) const; Real GetGDTTS(const Vec3List& other, bool norm=true) const;
Real GetGDT(const Vec3List& other, Real thresh, bool norm=true) const;
//This function fits a cylinder to the positions in Vec3List //This function fits a cylinder to the positions in Vec3List
//It takes as argument an initial guess for the direction. //It takes as argument an initial guess for the direction.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment