Class Representation::Voxel
Defined in File representation.hpp
Nested Relationships
This class is a nested type of Class Representation.
Class Documentation
-
class Voxel
Class that represents a 3D voxel (cell) in space.
Public Types
Pointer types: shared pointer.
-
using weak_ptr = std::weak_ptr<Voxel>
Weak pointer type.
Public Functions
-
inline Voxel(const array3Int_t &cornerMin_, const array3Int_t &cornerMax_, const cell_id_t &cellId_)
Constructs a voxel from integer-space corners.
- Parameters:
cornerMin_ – Minimum voxel corner in internal integer units.
cornerMax_ – Maximum voxel corner in internal integer units.
cellId_ – Unique cell identifier assigned to the voxel.
-
bool contains(const point_id_t &pointId_) const
Checks whether a point id is registered in this voxel.
- Parameters:
pointId_ – Point identifier tested for membership in this voxel.
- Returns:
trueif the point id exists in the voxel set.
-
bool contains(const array3D_t &point_) const
Checks whether coordinates lie inside voxel bounds.
- Parameters:
point_ – Query coordinates in internal units.
- Returns:
trueif the point is inside the voxel AABB.
-
array3Int_t::pair get_corners() const
Returns voxel integer corners.
- Returns:
Pair
(minCorner, maxCorner).
-
array3D_t get_center() const
Returns voxel center.
- Returns:
Center coordinates.
-
fail_t insert(const point_id_t &pointId_)
Inserts a point id into the voxel.
- Parameters:
pointId_ – Point identifier inserted into this voxel.
- Returns:
Success or failure state.
-
fail_t remove(const point_id_t &pointId_)
Removes a point id from the voxel.
- Parameters:
pointId_ – Point identifier removed from this voxel.
- Returns:
Success or failure state.
-
inline cell_id_t get_id() const
Returns the cell identifier.
- Returns:
Cell identifier.
-
inline point_id_t::set get_points()
Returns all point ids currently stored in the voxel.
- Returns:
Copy of the point-id set.
-
inline void highlight()
Marks the voxel as visible.
-
inline void unhighlight()
Marks the voxel as not visible.
-
inline bool is_highlighted() const
Returns whether the voxel is visible.
- Returns:
trueif the voxel is highlighted.
-
inline size_t get_point_count() const
Returns the number of points in the voxel.
- Returns:
Number of stored point ids.
Public Static Functions
Creates a shared voxel instance.
- Parameters:
cornerMin_ – Minimum voxel corner in internal integer units.
cornerMax_ – Maximum voxel corner in internal integer units.
cellId_ – Unique cell identifier assigned to the voxel.
- Returns:
Shared pointer to a new
Voxel.
Private Functions
-
bool __contains(const point_id_t &pointId_) const
Internal point-id containment check without locking.
- Parameters:
pointId_ – Point identifier tested for membership in
_points.- Returns:
trueif the point id exists inpoints.
Private Members
-
array3Int_t _cornerMin = {0, 0, 0}
Corners of the cell: Min.
-
array3Int_t _cornerMax = {0, 0, 0}
Corners of the cell: Max.
-
point_id_t::set _points
Points contained in the cell.
-
cell_id_t _cellId
cell id of the voxel
-
bool _isVisible = {false}
Whether the voxel is visible or not.
-
mutable std::shared_mutex _mutex
Mutex for thread-safe access.