Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/VectorSet.hpp

    rcb16fe r014475  
    1212#include <functional>
    1313#include <algorithm>
     14#include <limits>
    1415
    1516/**
     
    1920 */
    2021
    21 class Vector;
     22#include "vector.hpp"
     23#include <list>
    2224
    2325// this tests, whether we actually have a Vector
     
    4850  void translate(const Vector &translater){
    4951    // this is needed to allow template lookup
    50     transform(this->begin(),this->end(),this->begin(),bind1st(plus<Vector>(),translater));
     52    transform(this->begin(),this->end(),this->begin(),std::bind1st(std::plus<Vector>(),translater));
     53  }
     54
     55  double minDistSquared(const Vector &point){
     56    if(!this->size())
     57      return std::numeric_limits<double>::infinity();
     58    std::list<double> helper;
     59    helper.resize(this->size());
     60    transform(this->begin(),this->end(),
     61              helper.begin(),
     62              std::bind2nd(std::mem_fun_ref(&Vector::DistanceSquared),point));
     63    return *min_element(helper.begin(),helper.end());
    5164  }
    5265};
    5366
     67// allows simpler definition of VectorSets
     68#define VECTORSET(container_type) VectorSet<container_type<Vector> >
     69
    5470#endif /* VECTORSET_HPP_ */
Note: See TracChangeset for help on using the changeset viewer.