31#ifndef __FASTJET_CLOSESTPAIR2DBASE__HH__ 
   32#define __FASTJET_CLOSESTPAIR2DBASE__HH__ 
   35#include "fastjet/internal/base.hh" 
   37FASTJET_BEGIN_NAMESPACE      
 
   52  Coord2D(
double a, 
double b): x(a), y(b) {};
 
   56    return Coord2D(x - other.x,  y - other.y);};
 
   60    return Coord2D(x + other.x,  y + other.y);};
 
   65    return Coord2D(factor*coord.x,factor*coord.y);
 
   70    return Coord2D(x / divisor,  y / divisor);};
 
   74    double dx = a.x - b.x, dy = a.y-b.y;
 
   79    double dx = x - b.x, dy = y-b.y;
 
   96                            double & distance2) 
const = 0;
 
   99  virtual void remove(
unsigned int ID) = 0;
 
  108  virtual unsigned int replace(
unsigned int ID1, 
unsigned int ID2, 
 
  112    unsigned new_ID = insert(position);
 
  118  virtual void replace_many(
const std::vector<unsigned int> & IDs_to_remove,
 
  119                       const std::vector<Coord2D> & new_positions,
 
  120                       std::vector<unsigned int> & new_IDs) {
 
  121    for(
unsigned i = 0; i < IDs_to_remove.size(); i++) {
 
  122      remove(IDs_to_remove[i]);}
 
  124    for(
unsigned i = 0; i < new_positions.size(); i++) {
 
  125      new_IDs.push_back(insert(new_positions[i]));}
 
  128  virtual unsigned int size() = 0;
 
virtual unsigned int insert(const Coord2D &position)=0
inserts the position into the closest pair structure and returns the ID that has been allocated for t...
 
virtual void replace_many(const std::vector< unsigned int > &IDs_to_remove, const std::vector< Coord2D > &new_positions, std::vector< unsigned int > &new_IDs)
replaces IDs_to_remove with points at the new_positions indicating the IDs allocated to the new point...
 
virtual void closest_pair(unsigned int &ID1, unsigned int &ID2, double &distance2) const =0
provides the IDs of the closest pair as well as the squared distance between them
 
virtual unsigned int replace(unsigned int ID1, unsigned int ID2, const Coord2D &position)
replaces the specified ID1 and ID2 with something at a new position assuming that ID1 and ID2 are in ...
 
virtual void remove(unsigned int ID)=0
removes the entry labelled by ID from the object;
 
Coord2D operator/(double divisor) const
division of each component of coordinate
 
Coord2D operator*(double factor) const
return the product of the coordinate with the factor
 
double distance2(const Coord2D &b) const
return the squared distance between two coordinates
 
Coord2D operator+(const Coord2D &other) const
return the vector sum between two coordinates
 
friend double distance2(const Coord2D &a, const Coord2D &b)
return the squared distance between two coordinates
 
Coord2D operator-(const Coord2D &other) const
return the vector difference between two coordinates
 
Selector operator*(const Selector &s1, const Selector &s2)
successive application of 2 selectors