Template Class Quadtree

Class Documentation

template<class T, bool poincare = true>
class Quadtree

Public Functions

inline Quadtree()
inline Quadtree(double maxR, bool theoreticalSplit = false, double alpha = 1, count capacity = 1000, double balance = 0.5)
Parameters:
  • maxR – Radius of the managed area. Must be smaller than 1.

  • theoreticalSplit – If true, split cells to get the same area in each child cell. Default is false

  • alpha – dispersion Parameter of the point distribution. Only has an effect if theoretical split is true

  • capacity – How many points can inhabit a leaf cell before it is split up?

inline Quadtree(const vector<double> &angles, const vector<double> &radii, const vector<T> &content, double stretch, bool theoreticalSplit = false, double alpha = 1, count capacity = 1000, double balance = 0.5)
inline void addContent(T newcomer, double angle, double r)
Parameters:
  • newcomer – content to be added at point x

  • angle – angular coordinate of x

  • R – radial coordinate of x

inline bool removeContent(T toRemove, double angle, double r)
Parameters:
  • newcomer – content to be removed at point x

  • angle – angular coordinate of x

  • R – radial coordinate of x

inline vector<T> getElements() const

Get all elements, regardless of position

Returns:

vector<T> of elements

inline void extractCoordinates(vector<double> &anglesContainer, vector<double> &radiiContainer) const
inline vector<T> getElementsInHyperbolicCircle(Point2DWithIndex<double> circleCenter, double hyperbolicRadius) const

Get elements whose hyperbolic distance to the query point is less than the hyperbolic distance

Parameters:
  • circleCenter – Cartesian coordinates of the query circle’s center

  • hyperbolicRadius – Radius of the query circle

inline void getElementsInHyperbolicCircle(const Point2DWithIndex<double> circleCenter, const double hyperbolicRadius, const bool suppressLeft, vector<T> &circleDenizens) const
inline void getElementsInHyperbolicCircle(const Point2DWithIndex<double> circleCenter, const double hyperbolicRadius, vector<T> &circleDenizens) const
inline count getElementsProbabilistically(Point2DWithIndex<double> euQuery, std::function<double(double)> prob, vector<T> &circleDenizens)
inline count getElementsProbabilistically(Point2DWithIndex<double> euQuery, std::function<double(double)> prob, bool suppressLeft, vector<T> &circleDenizens)
inline void recount()
inline count size() const
inline count height() const
inline count countLeaves() const
inline index indexSubtree(index nextID)
inline index getCellID(double phi, double r) const
inline double getMaxRadius() const
inline void reindex()
inline void trim()

trims the vectors used to hold the content in the leaf cells. Reduces memory usage, makes changes slower