Bounding Box#

File: samarium/math/BoundingBox.hpp

namespace sm
template<concepts::Number T = f64>
struct BoundingBox#

Public Types

using VecType = Vector2_t<T>#

Public Functions

template<concepts::Number U>
inline constexpr auto as() const#
inline constexpr auto validate()#
inline constexpr auto validated() const#
inline constexpr auto contains(VecType vec) const noexcept#
inline constexpr auto diagonal() const noexcept#
inline constexpr auto clamp(VecType vec) const#
inline constexpr auto clamped_to(BoundingBox<T> bounds) const#
inline constexpr auto width() const#
inline constexpr auto height() const#
inline constexpr auto x_range() const#
inline constexpr auto y_range() const#
constexpr auto operator==(const BoundingBox<T>&) const -> bool = default#
inline constexpr auto centre() const noexcept#
inline constexpr auto set_centre(VecType new_centre) noexcept#
inline constexpr auto set_width(f64 new_width) noexcept#
inline constexpr auto set_height(f64 new_height) noexcept#

Public Members

VecType min#
VecType max#

Public Static Functions

static inline constexpr auto fit(const auto &points)#

Make a BoundingBox which fits a range of points.

Parameters:

points – points to fit around

static inline constexpr auto square(T width) noexcept#
requires std
static inline constexpr auto from_centre_width_height(VecType centre, T width, T height) noexcept#