aabb.ixx File
Axis-Aligned Bounding Box (AABB) type and transformations. More...
Included Headers
#include <memory>
#include <cassert>
#include <algorithm>
#include <helios.math.traits.FloatingPointType>
#include <helios.math.concepts>
#include <helios.math.types:mat4>
Namespaces Index
| namespace | helios |
| namespace | math |
Classes Index
| struct | aabb<T> |
|
Axis-Aligned Bounding Box for spatial culling and collision detection. More... | |
Description
Axis-Aligned Bounding Box (AABB) type and transformations.
File Listing
The file content with the documentation metadata removed is:
17export namespace helios::math {
42 helios::math::vec3<T> min_;
49 helios::math::vec3<T> max_;
61 : min_{std::numeric_limits<T>::max(), std::numeric_limits<T>::max(), std::numeric_limits<T>::max()},
62 max_{std::numeric_limits<T>::lowest(), std::numeric_limits<T>::lowest(), std::numeric_limits<T>::lowest()}
75 constexpr aabb(const T minX, const T minY, const T minZ, const T maxX, const T maxY, const T maxZ) noexcept
86 constexpr aabb(const helios::math::vec3<T> min, const helios::math::vec3<T> max) noexcept
87 : min_(min),
88 max_(max)
96 [[nodiscard]] constexpr const helios::math::vec3<T>& min() const noexcept {
105 [[nodiscard]] constexpr const helios::math::vec3<T>& max() const noexcept {
114 [[nodiscard]] constexpr helios::math::vec3<T> center() const noexcept {
124 [[nodiscard]] constexpr helios::math::vec3<T> extent() const noexcept {
134 [[nodiscard]] constexpr helios::math::vec3<T> size() const noexcept {
148 [[nodiscard]] constexpr bool contains(const helios::math::aabb<T>& box) const noexcept {
165 [[nodiscard]] constexpr bool contains(const helios::math::vec3<T>& point) const noexcept {
177 [[nodiscard]] constexpr bool intersects(const helios::math::aabb<T>& box) const noexcept {
202 [[nodiscard]] constexpr helios::math::aabb<T> translate(const helios::math::vec3<T>& v) const noexcept {
203 return helios::math::aabb<T>{
220 void add(const helios::math::vec3<T>& point) noexcept {
246 [[nodiscard]] aabb<T> applyTransform(const mat4<T>& mat) const noexcept {
252 vec3<T> newMin = {translationX, translationY, translationZ};
253 vec3<T> newMax = newMin;
273 return aabb<T>(newMin, newMax);
293 [[nodiscard]] constexpr helios::math::vec3<T> overlap(
294 const helios::math::aabb<T> a, const helios::math::aabb<T> b) noexcept {
296 const auto overlapMin = helios::math::vec3<T>{
302 const auto overlapMax = helios::math::vec3<T>{
325 [[nodiscard]] constexpr helios::math::vec3<T> overlapCenter(
326 const helios::math::aabb<T> a, const helios::math::aabb<T> b) noexcept {
328 const auto overlapMin = helios::math::vec3<T>{
334 const auto overlapMax = helios::math::vec3<T>{
356 [[nodiscard]] constexpr helios::math::aabb<T> operator+(
357 const helios::math::aabb<T> aabb, const helios::math::vec3<T> v) noexcept {
374 [[nodiscard]] constexpr helios::math::aabb<T> operator*(
375 const helios::math::aabb<T>& aabb, const helios::math::vec3<T> v) noexcept {
377 return helios::math::aabb<T>{aabb.min() * v, aabb.max() * v};
383 using aabbf = aabb<float>;
393 using aabbui = aabb<unsigned int>;
398 using aabbd = aabb<double>;
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.