cesium-native 0.43.0
Loading...
Searching...
No Matches
AxisAlignedBox.h
1#pragma once
2
3#include "Library.h"
4
5#include <glm/vec3.hpp>
6
7namespace CesiumGeometry {
8
13struct CESIUMGEOMETRY_API AxisAlignedBox final {
14
19 constexpr AxisAlignedBox() noexcept
20 : minimumX(0.0),
21 minimumY(0.0),
22 minimumZ(0.0),
23 maximumX(0.0),
24 maximumY(0.0),
25 maximumZ(0.0),
26 lengthX(0.0),
27 lengthY(0.0),
28 lengthZ(0.0),
29 center(0.0) {}
30
41 constexpr AxisAlignedBox(
42 double minimumX_,
43 double minimumY_,
44 double minimumZ_,
45 double maximumX_,
46 double maximumY_,
47 double maximumZ_) noexcept
48 : minimumX(minimumX_),
49 minimumY(minimumY_),
50 minimumZ(minimumZ_),
51 maximumX(maximumX_),
52 maximumY(maximumY_),
53 maximumZ(maximumZ_),
54 lengthX(maximumX - minimumX),
55 lengthY(maximumY - minimumY),
56 lengthZ(maximumZ - minimumZ),
57 center(
58 0.5 * (maximumX + minimumX),
59 0.5 * (maximumY + minimumY),
60 0.5 * (maximumZ + minimumZ)) {}
61
65 double minimumX;
66
70 double minimumY;
71
75 double minimumZ;
76
80 double maximumX;
81
85 double maximumY;
86
90 double maximumZ;
91
95 double lengthX;
96
100 double lengthY;
101
105 double lengthZ;
106
110 glm::dvec3 center;
111
118 constexpr bool contains(const glm::dvec3& position) const noexcept {
119 return position.x >= this->minimumX && position.x <= this->maximumX &&
120 position.y >= this->minimumY && position.y <= this->maximumY &&
121 position.z >= this->minimumZ && position.z <= this->maximumZ;
122 }
123};
124
125} // namespace CesiumGeometry
Basic geometry classes for Cesium.
An Axis-Aligned Bounding Box (AABB), where the axes of the box are aligned with the axes of the coord...
double maximumY
The maximum y-coordinate.
constexpr AxisAlignedBox() noexcept
Creates an empty AABB with a length, width, and height of zero, with the center located at (0,...
double lengthY
The length of the box on the y-axis.
constexpr AxisAlignedBox(double minimumX_, double minimumY_, double minimumZ_, double maximumX_, double maximumY_, double maximumZ_) noexcept
Creates a new AABB using the range of coordinates the box covers.
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.
constexpr bool contains(const glm::dvec3 &position) const noexcept
Checks if this AABB contains the given position.
double minimumX
The minimum x-coordinate.
double maximumZ
The maximum z-coordinate.
double lengthZ
The length of the box on the z-axis.