8namespace Cogs::Core::OGC3DTiles {
17 std::string toString()
const {
18 std::string s = std::to_string(this->level);
20 s += std::to_string(this->x);
22 s += std::to_string(this->y);
25 s += std::to_string(this->z);
30 uint64_t toHash()
const {
33 (uint64_t(this->level) << (64 - 7)) +
34 (uint64_t(this->x) << (19 << 1)) +
35 (uint64_t(this->y) << 19);
37 result += this->z >= 0 ? uint64_t(this->z) : 0b1111111111111111111;
42 static Coord fromHash(uint64_t h) {
44 c.level = int32_t(h >> (64 - 7));
45 c.x = int32_t(h >> (19 * 2)) & 0b1111111111111111111;
46 c.y = int32_t(h >> 19) & 0b1111111111111111111;
47 const int32_t z = int32_t(h & 0b1111111111111111111);
48 c.z = z == 0b1111111111111111111 ? -1 : z;
54 enum class BoundingVolumeType { UNKNOWN, BOX, REGION, SPHERE };
57 BoundingVolumeType type;
58 std::array<double, 12> values;
60 std::string toString()
const {
63 if (this->type == BoundingVolumeType::BOX) {
67 else if (this->type == BoundingVolumeType::REGION) {
71 else if (this->type == BoundingVolumeType::SPHERE) {
77 for (
int i = 0; i < num; ++i) {
78 s += std::to_string(this->values[i]) +
", ";
83 return "Invalid BoundingVolume";