cesium-native  0.41.0
AxisAlignedBox.h
1 #pragma once
2 
3 #include "Library.h"
4 
5 #include <glm/vec3.hpp>
6 
7 namespace CesiumGeometry {
8 
9 struct CESIUMGEOMETRY_API AxisAlignedBox final {
10 
11  constexpr AxisAlignedBox() noexcept
12  : minimumX(0.0),
13  minimumY(0.0),
14  minimumZ(0.0),
15  maximumX(0.0),
16  maximumY(0.0),
17  maximumZ(0.0),
18  lengthX(0.0),
19  lengthY(0.0),
20  lengthZ(0.0),
21  center(0.0) {}
22 
23  constexpr AxisAlignedBox(
24  double minimumX_,
25  double minimumY_,
26  double minimumZ_,
27  double maximumX_,
28  double maximumY_,
29  double maximumZ_) noexcept
30  : minimumX(minimumX_),
31  minimumY(minimumY_),
32  minimumZ(minimumZ_),
33  maximumX(maximumX_),
34  maximumY(maximumY_),
35  maximumZ(maximumZ_),
36  lengthX(maximumX - minimumX),
37  lengthY(maximumY - minimumY),
38  lengthZ(maximumZ - minimumZ),
39  center(
40  0.5 * (maximumX + minimumX),
41  0.5 * (maximumY + minimumY),
42  0.5 * (maximumZ + minimumZ)) {}
43 
47  double minimumX;
48 
52  double minimumY;
53 
57  double minimumZ;
58 
62  double maximumX;
63 
67  double maximumY;
68 
72  double maximumZ;
73 
77  double lengthX;
78 
82  double lengthY;
83 
87  double lengthZ;
88 
92  glm::dvec3 center;
93 
94  constexpr bool contains(const glm::dvec3& position) const noexcept {
95  return position.x >= this->minimumX && position.x <= this->maximumX &&
96  position.y >= this->minimumY && position.y <= this->maximumY &&
97  position.z >= this->minimumZ && position.z <= this->maximumZ;
98  }
99 };
100 
101 } // namespace CesiumGeometry
Basic geometry classes for Cesium.
double maximumY
The maximum y-coordinate.
double lengthY
The length of the box on the y-axis.
double lengthX
The length of the box on the x-axis.
double minimumY
The minimum y-coordinate.
double minimumZ
The minimum z-coordinate.
double maximumX
The maximum x-coordinate.
glm::dvec3 center
The center of the box.
double minimumX
The minimum x-coordinate.
double maximumZ
The maximum z-coordinate.
double lengthZ
The length of the box on the z-axis.