Template Class QuadNodeCartesianEuclid

Class Documentation

template<class T>
class QuadNodeCartesianEuclid

Public Functions

inline QuadNodeCartesianEuclid(const Point<double> &lower = Point<double>(0.0, 0.0), const Point<double> &upper = Point<double>(1.0, 1.0), unsigned capacity = 1000, bool splitTheoretical = false)

Construct a QuadNode for polar coordinates.

Parameters:
  • lower – Minimal coordinates of region

  • upper – Maximal coordinates of region (excluded)

  • capacity – Number of points a leaf cell can store before splitting

  • splitTheoretical – Whether to split in a theoretically optimal way or in a way to decrease measured running times

inline void split()
inline void addContent(T input, Point<double> pos)

Add a point at polar coordinates (angle, R) with content input. May split node if capacity is full

Parameters:
  • input – arbitrary content, in our case an index

  • angle – angular coordinate of point, between 0 and 2 pi.

  • R – radial coordinate of point, between 0 and 1.

inline bool removeContent(T input, Point<double> pos)

Remove content at coordinate pos. May cause coarsening of the quadtree

Parameters:
  • input – Content to be removed

  • pos – Coordinate of content

Returns:

True if content was found and removed, false otherwise

inline bool outOfReach(const Point<double> &query, double radius) const

Check whether the region managed by this node lies outside of an Euclidean circle.

Parameters:
  • query – Center of the Euclidean query circle, given in Cartesian coordinates

  • radius – Radius of the Euclidean query circle

Returns:

True if the region managed by this node lies completely outside of the circle

inline std::pair<double, double> EuclideanDistances(const Point<double> &query) const
Parameters:

query – Position of the query point

inline bool responsible(Point<double> pos) const

Does the point at (angle, r) fall inside the region managed by this QuadNode?

Parameters:
  • angle – Angular coordinate of input point

  • r – Radial coordinate of input points

Returns:

True if input point lies within the region of this QuadNode

inline std::vector<T> getElements() const

Get all Elements in this QuadNode or a descendant of it

Returns:

vector of content type T

inline void getCoordinates(vector<Point<double>> &pointContainer) const
inline void getElementsInEuclideanCircle(Point<double> center, double radius, vector<T> &result) const

Main query method, get points lying in a Euclidean circle around the center point. Optional limits can be given to get a different result or to reduce unnecessary comparisons

Elements are pushed onto a vector which is a required argument. This is done to reduce copying. (Maybe not necessary due to copy elisison)

Safe to call in parallel.

Parameters:
  • center – Center of the query circle

  • radius – Radius of the query circle

  • result – Reference to the vector where the results will be stored

  • minAngle – Optional value for the minimum angular coordinate of the query region

  • maxAngle – Optional value for the maximum angular coordinate of the query region

  • lowR – Optional value for the minimum radial coordinate of the query region

  • highR – Optional value for the maximum radial coordinate of the query region

inline count getElementsProbabilistically(Point<double> euQuery, std::function<double(double)> prob, vector<T> &result) const
inline void maybeGetKthElement(double upperBound, Point<double> euQuery, std::function<double(double)> prob, index k, vector<T> &circleDenizens) const
inline void trim()

Shrink all vectors in this subtree to fit the content. Call after quadtree construction is complete, causes better memory usage and cache efficiency

inline count size() const

Number of points lying in the region managed by this QuadNode

inline void recount()
inline count height() const

Height of subtree hanging from this QuadNode

inline count countLeaves() const

Leaf cells in the subtree hanging from this QuadNode

inline index getID() const
inline index indexSubtree(index nextID)
inline index getCellID(Point<double> pos) const
inline index getMaxIDInSubtree() const
inline count reindex(count offset)

Public Members

std::vector<QuadNodeCartesianEuclid> children