#include <bounds.hpp>
template<typename vector_type>
generic_bounds struct
Contents
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 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 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. |