Bounding Box

File: samarium/math/Box2.hpp

namespace sm

Enums

enum class PlacementX

Values:

enumerator Left
enumerator Middle
enumerator Right
enum class PlacementY

Values:

enumerator Bottom
enumerator Middle
enumerator Top
struct Placement

Public Members

PlacementX x = {}
PlacementY y = {}
template<concepts::Number T = f64>
struct Box2

Public Types

using VecType = Vec2_t<T>

Public Functions

template<concepts::Number U>
inline constexpr auto cast() 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(Box2<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 bool operator==(const Box2<T>&) const = default
inline constexpr auto centre() const noexcept
inline constexpr auto set_centre(VecType new_centre) noexcept
inline constexpr auto set_width(T new_width) noexcept
inline constexpr auto set_height(T new_height) noexcept
inline constexpr auto scaled(T scale) const noexcept
inline constexpr auto scaled_x(T scale) const noexcept
inline constexpr auto scaled_y(T scale) const noexcept
inline constexpr auto line_segments() const noexcept
requires concepts
inline constexpr auto get_placement(Placement p)

Public Members

VecType min
VecType max

Public Static Functions

static inline constexpr auto fit_points(const auto &points)

Make a Box2 which fits a range of points.

Parameters:

points – points to fit around

static inline constexpr auto fit_boxes(Box2<T> a, Box2<T> b)
static inline constexpr auto fit_boxes(const auto &boxes)
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