cesium-native  0.41.0
OctreeTilingScheme.h
1 #pragma once
2 
3 #include "CesiumGeometry/AxisAlignedBox.h"
4 #include "CesiumGeometry/Library.h"
5 #include "CesiumGeometry/OctreeTileID.h"
6 
7 #include <glm/vec3.hpp>
8 
9 #include <optional>
10 
11 namespace CesiumGeometry {
12 
17 class CESIUMGEOMETRY_API OctreeTilingScheme {
18 public:
32  const AxisAlignedBox& box,
33  uint32_t rootTilesX,
34  uint32_t rootTilesY,
35  uint32_t rootTilesZ) noexcept;
36 
40  const AxisAlignedBox& getBox() const noexcept { return this->_box; }
41 
45  uint32_t getRootTilesX() const noexcept { return this->_rootTilesX; }
46 
50  uint32_t getRootTilesY() const noexcept { return this->_rootTilesY; }
51 
55  uint32_t getRootTilesZ() const noexcept { return this->_rootTilesZ; }
56 
60  uint32_t getNumberOfXTilesAtLevel(uint32_t level) const noexcept;
61 
65  uint32_t getNumberOfYTilesAtLevel(uint32_t level) const noexcept;
66 
70  uint32_t getNumberOfZTilesAtLevel(uint32_t level) const noexcept;
71 
85  std::optional<CesiumGeometry::OctreeTileID>
86  positionToTile(const glm::dvec3& position, uint32_t level) const noexcept;
87 
100  tileToBox(const CesiumGeometry::OctreeTileID& tileID) const noexcept;
101 
102 private:
103  AxisAlignedBox _box;
104  uint32_t _rootTilesX;
105  uint32_t _rootTilesY;
106  uint32_t _rootTilesZ;
107 };
108 
109 } // namespace CesiumGeometry
Defines how an AxisAlignedBox is divided into octree tiles.
uint32_t getNumberOfXTilesAtLevel(uint32_t level) const noexcept
Returns the number of tiles, in x-direction, at the given level.
uint32_t getRootTilesX() const noexcept
Returns the number of root tiles, in x-direction.
uint32_t getRootTilesZ() const noexcept
Returns the number of root tiles, in z-direction.
OctreeTilingScheme(const AxisAlignedBox &box, uint32_t rootTilesX, uint32_t rootTilesY, uint32_t rootTilesZ) noexcept
Constructs a new instance.
std::optional< CesiumGeometry::OctreeTileID > positionToTile(const glm::dvec3 &position, uint32_t level) const noexcept
Computes the CesiumGeometry::OctreeTileID for a given position and level.
AxisAlignedBox tileToBox(const CesiumGeometry::OctreeTileID &tileID) const noexcept
Returns the AxisAlignedBox that is covered by the specified tile.
const AxisAlignedBox & getBox() const noexcept
Return the overall box that is tiled.
uint32_t getRootTilesY() const noexcept
Returns the number of root tiles, in y-direction.
uint32_t getNumberOfYTilesAtLevel(uint32_t level) const noexcept
Returns the number of tiles, in y-direction, at the given level.
uint32_t getNumberOfZTilesAtLevel(uint32_t level) const noexcept
Returns the number of tiles, in z-direction, at the given level.
Basic geometry classes for Cesium.
A structure serving as a unique identifier for a node in an octree.
Definition: OctreeTileID.h:18