diff --git a/modules/geom/pymod/export_vecmat3_op.cc b/modules/geom/pymod/export_vecmat3_op.cc index 048cdd170b4ca4e45c724db50f21d7a93fdcabd6..75787dd5300fd38a92c4608654a0c3f675bc7388 100644 --- a/modules/geom/pymod/export_vecmat3_op.cc +++ b/modules/geom/pymod/export_vecmat3_op.cc @@ -64,4 +64,5 @@ void export_VecMat3_op() def("OrthogonalVector",OrthogonalVector); def("Min",Vec3Min); def("Max",Vec3Max); + def("MinDistance",MinDistance); } diff --git a/modules/geom/src/vecmat3_op.cc b/modules/geom/src/vecmat3_op.cc index 0ce26dde3f1684710265b3c0cc1c79f69ee8bf01..8dd8eb11bc38a73104508c11cfca3a5d9ff6b107 100644 --- a/modules/geom/src/vecmat3_op.cc +++ b/modules/geom/src/vecmat3_op.cc @@ -196,15 +196,15 @@ Real MinDistance(const Vec3List& l1, const Vec3List& l2) { // returns the minimal distance between two sets of points (Vec3List) if (l1.size()==0 || l2.size()==0){throw std::runtime_error("cannot calculate minimal distance: empty Vec3List");} - Real min=Distance(*l1.begin(),*l2.begin()); + Real min=Length2(*l1.begin()-*l2.begin()); Real d; for (Vec3List::const_iterator p1=l1.begin(),e1=l1.end(); p1!=e1; p1++) { for (Vec3List::const_iterator p2=l2.begin(),e2=l2.end(); p2!=e2; p2++) { - d=Distance(*p1,*p2); + d=Length2(*p1-*p2); if (d<min) min=d; } } - return min; + return std::sqrt(min); } } // ns