* @class PointSet. * Represents a set of points in three-dimensional space. */
| 14 | * Represents a set of points in three-dimensional space. |
| 15 | */ |
| 16 | class PointSet |
| 17 | { |
| 18 | |
| 19 | public: |
| 20 | |
| 21 | /** |
| 22 | * Copy constructor. |
| 23 | */ |
| 24 | PointSet(PointSet const& other) |
| 25 | { |
| 26 | *this = other; |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Assignment operator. |
| 31 | */ |
| 32 | PointSet& operator=(PointSet const& other) |
| 33 | { |
| 34 | m_x = other.m_x; |
| 35 | m_n = other.m_n; |
| 36 | m_dynamic = other.m_dynamic; |
| 37 | m_search_neighbors = other.m_search_neighbors; |
| 38 | |
| 39 | m_neighbors = other.m_neighbors; |
| 40 | m_keys = other.m_keys; |
| 41 | m_old_keys = other.m_old_keys; |
| 42 | m_locks.resize(other.m_locks.size()); |
| 43 | m_sort_table = other.m_sort_table; |
| 44 | |
| 45 | return *this; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Returns the number of neighbors of point i in the given point set. |
| 50 | * @param i Point index. |
| 51 | * @returns Number of points neighboring point i. |
| 52 | */ |
| 53 | std::size_t n_neighbors(unsigned int i) const |
| 54 | { |
| 55 | return static_cast<unsigned int>(m_neighbors[i].size()); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Fetches id pair of kth neighbor of point i in the given point set. |
| 60 | * @param i Point index for which the neighbor id should be returned. |
| 61 | * @param k Represents kth neighbor of point i. |
| 62 | * @returns Number of points neighboring point i. |
| 63 | */ |
| 64 | PointID const& neighbor(unsigned int i, unsigned int k) const |
| 65 | { |
| 66 | return m_neighbors[i][k]; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Returns the number of points contained in the point set. |
| 71 | */ |
| 72 | std::size_t n_points() const { return m_n; } |
| 73 |