1#ifndef LIBSBX_MATH_VOLUME_HPP_
2#define LIBSBX_MATH_VOLUME_HPP_
4#include <libsbx/math/concepts.hpp>
5#include <libsbx/math/vector3.hpp>
6#include <libsbx/math/matrix4x4.hpp>
15 using value_type = Type;
25 auto min =
math::vector3{std::numeric_limits<std::float_t>::max()};
26 auto max =
math::vector3{std::numeric_limits<std::float_t>::lowest()};
28 for (
const auto& corner :
volume.corners()) {
30 min = math::vector3::min(min, transformed);
31 max = math::vector3::max(max, transformed);
46 return (_min + _max) / 2.0f;
49 auto corners()
const noexcept -> std::array<math::vector3, 8u> {
50 return std::array<math::vector3, 8u>{
62 auto contains(
const vector_type& point)
const noexcept ->
bool {
63 return point.x() >= _min.x() && point.x() <= _max.x() && point.y() >= _min.y() && point.y() <= _max.y() && point.z() >= _min.z() && point.z() <= _max.z();
66 auto contains(
const basic_volume& other)
const noexcept ->
bool {
67 return _min.x() <= other.min().x() && _min.y() <= other.min().y() && _min.z() <= other.min().z() && _max.x() >= other.max().x() && _max.y() >= other.max().y() && _max.z() >= other.max().z();
70 auto intersects(
const basic_volume& other)
const noexcept ->
bool {
71 return _min.x() <= other.max().x() && _max.x() >= other.min().x() && _min.y() <= other.max().y() && _max.y() >= other.min().y() && _min.z() <= other.max().z() && _max.z() >= other.min().z();
74 auto diagonal_length()
const noexcept -> value_type {
75 return (_max - _min).length();
Definition: matrix4x4.hpp:25
Definition: vector4.hpp:22
Definition: volume.hpp:11