#include <bounds.hpp>
template<typename vector_type>
move::vectormath::generic_bounds struct

Public types

using component_type = typename vector_type::component_type
using vec_type = vector_type

Constructors, destructors, conversion operators

generic_bounds() defaulted
Creates a new bounding box with the minimum and maximum set to zero.

Public functions

auto generic_bounds(const vec_type& min, const vec_type& max) -> MVM_INLINE
Creates a new bounding box with the given minimum and maximum values.
auto generic_bounds(const vec_type& point) -> MVM_INLINE
Creates a new bounding box with the minimum and maximum bounded exactly to a single point.
auto min() const -> MVM_INLINE_NODISCARD vec_type
Returns the minimum value of the bounding box.
auto max() const -> MVM_INLINE_NODISCARD vec_type
Returns the maximum value of the bounding box.
auto min(const vec_type& min) -> MVM_INLINE generic_bounds&
Sets the minimum value of the bounding box.
auto max(const vec_type& max) -> MVM_INLINE generic_bounds&
Sets the maximum value of the bounding box.
auto center() const -> MVM_INLINE_NODISCARD vec_type
Returns the center of the bounding box.
auto size() const -> MVM_INLINE_NODISCARD vec_type
Returns the size of the bounding box.
auto extents() const -> MVM_INLINE_NODISCARD vec_type
Returns the extents of the bounding box.
auto contains(const vec_type& point) const -> MVM_INLINE_NODISCARD bool
Checks if the bounding box contains the given point.
auto closest_point(const vec_type& point) const -> MVM_INLINE vec_type
Returns the closest point on the bounding box to the given point.
auto intersects(const generic_bounds& bounds) const -> MVM_INLINE_NODISCARD bool
Checks if the bounding box intersects with the given bounding box.
auto intersects(const vec_type& origin, const vec_type& direction, const component_type tmin, const component_type tmax) const -> MVM_INLINE_NODISCARD bool
Checks if the bounding box intersects with a ray.
auto encapsulate(const vec_type& point) -> MVM_INLINE generic_bounds&
Grows the bounding box to include the given point.
auto encapsulate(const generic_bounds& bounds) -> MVM_INLINE generic_bounds&
Grows the bounding box to include the given bounding box.
auto expand(const vec_type& amount) -> MVM_INLINE generic_bounds&
Grows the bounding box by the given amount.

Function documentation

template<typename vector_type>
MVM_INLINE_NODISCARD vec_type move::vectormath::generic_bounds<vector_type>::min() const

Returns the minimum value of the bounding box.

Returns The minimum value of the bounding box.

template<typename vector_type>
MVM_INLINE_NODISCARD vec_type move::vectormath::generic_bounds<vector_type>::max() const

Returns the maximum value of the bounding box.

Returns The maximum value of the bounding box.

template<typename vector_type>
MVM_INLINE generic_bounds& move::vectormath::generic_bounds<vector_type>::min(const vec_type& min)

Sets the minimum value of the bounding box.

Parameters
min The new minimum value of the bounding box.
Returns A reference to the bounding box.

template<typename vector_type>
MVM_INLINE generic_bounds& move::vectormath::generic_bounds<vector_type>::max(const vec_type& max)

Sets the maximum value of the bounding box.

Parameters
max The new maximum value of the bounding box.
Returns A reference to the bounding box.

template<typename vector_type>
MVM_INLINE_NODISCARD vec_type move::vectormath::generic_bounds<vector_type>::center() const

Returns the center of the bounding box.

Returns The center of the bounding box.

template<typename vector_type>
MVM_INLINE_NODISCARD vec_type move::vectormath::generic_bounds<vector_type>::size() const

Returns the size of the bounding box.

Returns The size of the bounding box.

template<typename vector_type>
MVM_INLINE_NODISCARD vec_type move::vectormath::generic_bounds<vector_type>::extents() const

Returns the extents of the bounding box.

Returns The extents of the bounding box.

template<typename vector_type>
MVM_INLINE_NODISCARD bool move::vectormath::generic_bounds<vector_type>::contains(const vec_type& point) const

Checks if the bounding box contains the given point.

Parameters
point The point to check.
Returns True if the bounding box contains the point, false otherwise.

template<typename vector_type>
MVM_INLINE vec_type move::vectormath::generic_bounds<vector_type>::closest_point(const vec_type& point) const

Returns the closest point on the bounding box to the given point.

Parameters
point The point to check.
Returns The closest point on the bounding box to the given point.

template<typename vector_type>
MVM_INLINE_NODISCARD bool move::vectormath::generic_bounds<vector_type>::intersects(const generic_bounds& bounds) const

Checks if the bounding box intersects with the given bounding box.

Parameters
bounds The bounding box to check.
Returns true if the bounding box intersects with the given bounding box

template<typename vector_type>
MVM_INLINE_NODISCARD bool move::vectormath::generic_bounds<vector_type>::intersects(const vec_type& origin, const vec_type& direction, const component_type tmin, const component_type tmax) const

Checks if the bounding box intersects with a ray.

Parameters
origin The origin of the ray.
direction The direction of the ray.
tmin The minimum distance of the ray.
tmax The maximum distance of the ray.
Returns true if the bounding box intersects with the ray.

template<typename vector_type>
MVM_INLINE generic_bounds& move::vectormath::generic_bounds<vector_type>::encapsulate(const vec_type& point)

Grows the bounding box to include the given point.

Parameters
point The point to include.

template<typename vector_type>
MVM_INLINE generic_bounds& move::vectormath::generic_bounds<vector_type>::encapsulate(const generic_bounds& bounds)

Grows the bounding box to include the given bounding box.

Parameters
bounds The bounding box to include.

template<typename vector_type>
MVM_INLINE generic_bounds& move::vectormath::generic_bounds<vector_type>::expand(const vec_type& amount)

Grows the bounding box by the given amount.

Parameters
amount The amount to grow the bounding box by.