Skip to content

dakku::BoundsBase

bounding box base More...

#include <bounds.h>

Public Functions

Name
BoundsBase() =default
default constructor
BoundsBase(const Point< T, S > & p)
Construct a new Bounds2 with a point.
template <ArithmeticType U>
BoundsBase(const BoundsBase< U, S > & b)
type conversion
BoundsBase(const Point< T, S > & p1, const Point< T, S > & p2)
Construct a new Bounds Base object with two points (take min/max of them to pMin and pMax)
BoundsBase(const sol::table & table)
Vector< T, S > diagonal() const
get the diagonal of the bounding box
size_t max_extent() const
get the dimension who has the maximum extent
bool operator==(const BoundsBase & rhs) const
bool operator!=(const BoundsBase & rhs) const
Point< T, S > lerp(const Point< float, S > & t) const
linera interpolation between pMin and pMax
Vector< T, S > offset(const Point< T, S > & p) const
get the offset \(v\) of a point, p = o + v * d
bool overlaps(const BoundsBase & rhs) const
check whether two bounds overlaps
bool inside(const Point< T, S > & p) const
check whether point is inside the bounds (inclusive)
bool inside_exclusive(const Point< T, S > & p) const
check whether point is inside the bounds (exclusive)
void bounding_sphere(Point< T, S > & center, float & rad)
get the bounding sphere of the bounds
BoundsBase union_bounds(const BoundsBase & rhs) const
take the union of the two bounds
BoundsBase union_bounds(const Point< T, S > & p) const
take the union between bounds and a point
BoundsBase intersect(const BoundsBase & rhs) const
take the intersect between two bounds
std::string to_string() const

Public Attributes

Name
Point< T, S > p_min
left bottom corner of the bounds
Point< T, S > p_max
right top corner of the bounds

Friends

Name
bool overlaps(const BoundsBase & a, const BoundsBase & b)
check whether two bounds overlaps
bool inside(const Point< T, S > & p, const BoundsBase & b)
check whether point is inside the bounds (inclusive)
bool inside_exclusive(const Point< T, S > & p, const BoundsBase & b)
check whether point is inside the bounds (exclusive)
BoundsBase **[operator
BoundsBase **[operator
BoundsBase operator&(const BoundsBase & a, const BoundsBase & b)
take the intersect between two bounds
decltype(auto) distance_squared(const Point< T, S > & p, const BoundsBase< T, S > & b)
minimum squared distance between point and bounds, if inside return 0
decltype(auto) distance(const Point< T, S > & p, const BoundsBase< T, S > & b)
minimum distance between point and bounds, if inside return 0
std::ostream & operator<<(std::ostream & os, const BoundsBase & b)

Detailed Description

template <ArithmeticType T,
size_t S>
class dakku::BoundsBase;

bounding box base

Template Parameters:

  • T data type
  • S dimension

Public Functions Documentation

function BoundsBase

BoundsBase() =default

default constructor

function BoundsBase

inline explicit BoundsBase(
    const Point< T, S > & p
)

Construct a new Bounds2 with a point.

Parameters:

  • p the given point

function BoundsBase

template <ArithmeticType U>
inline explicit BoundsBase(
    const BoundsBase< U, S > & b
)

type conversion

function BoundsBase

inline BoundsBase(
    const Point< T, S > & p1,
    const Point< T, S > & p2
)

Construct a new Bounds Base object with two points (take min/max of them to pMin and pMax)

function BoundsBase

inline BoundsBase(
    const sol::table & table
)

function diagonal

inline Vector< T, S > diagonal() const

get the diagonal of the bounding box

function max_extent

inline size_t max_extent() const

get the dimension who has the maximum extent

Return: the dimension

function operator==

inline bool operator==(
    const BoundsBase & rhs
) const

function operator!=

inline bool operator!=(
    const BoundsBase & rhs
) const

function lerp

inline Point< T, S > lerp(
    const Point< float, S > & t
) const

linera interpolation between pMin and pMax

Parameters:

  • t interpolate \(t\) (element wise)

function offset

inline Vector< T, S > offset(
    const Point< T, S > & p
) const

get the offset \(v\) of a point, p = o + v * d

Parameters:

  • p the point

Return: the offset

function overlaps

inline bool overlaps(
    const BoundsBase & rhs
) const

check whether two bounds overlaps

function inside

inline bool inside(
    const Point< T, S > & p
) const

check whether point is inside the bounds (inclusive)

Parameters:

  • p the point

function inside_exclusive

inline bool inside_exclusive(
    const Point< T, S > & p
) const

check whether point is inside the bounds (exclusive)

Parameters:

  • p the point

function bounding_sphere

inline void bounding_sphere(
    Point< T, S > & center,
    float & rad
)

get the bounding sphere of the bounds

Parameters:

  • center the center of the sphere
  • rad the radius of the sphere

function union_bounds

inline BoundsBase union_bounds(
    const BoundsBase & rhs
) const

take the union of the two bounds

function union_bounds

inline BoundsBase union_bounds(
    const Point< T, S > & p
) const

take the union between bounds and a point

function intersect

inline BoundsBase intersect(
    const BoundsBase & rhs
) const

take the intersect between two bounds

function to_string

inline std::string to_string() const

Public Attributes Documentation

variable p_min

Point< T, S > p_min {std::numeric_limits<T>::max()};

left bottom corner of the bounds

variable p_max

Point< T, S > p_max {std::numeric_limits<T>::lowest()};

right top corner of the bounds

Friends

friend overlaps

friend bool overlaps(
    const BoundsBase & a,

    const BoundsBase & b
);

check whether two bounds overlaps

friend inside

friend bool inside(
    const Point< T, S > & p,

    const BoundsBase & b
);

check whether point is inside the bounds (inclusive)

Parameters:

  • p the point
  • b the bounds

friend inside_exclusive

friend bool inside_exclusive(
    const Point< T, S > & p,

    const BoundsBase & b
);

check whether point is inside the bounds (exclusive)

Parameters:

  • p the point
  • b the bounds

friend operator|

friend BoundsBase operator|(
    const BoundsBase & a,

    const BoundsBase & b
);

take the union of the two bounds

friend operator|

friend BoundsBase operator|(
    const BoundsBase & b,

    const Point< T, S > & p
);

take the union between bounds and a point

friend operator&

friend BoundsBase operator&(
    const BoundsBase & a,

    const BoundsBase & b
);

take the intersect between two bounds

friend distance_squared

friend decltype(auto) distance_squared(
    const Point< T, S > & p,

    const BoundsBase< T, S > & b
);

minimum squared distance between point and bounds, if inside return 0

Parameters:

  • p the point
  • b the bounds

Return: the squared distance

friend distance

friend decltype(auto) distance(
    const Point< T, S > & p,

    const BoundsBase< T, S > & b
);

minimum distance between point and bounds, if inside return 0

Parameters:

  • p the point
  • b the bounds

Return: the distance

friend operator<<

friend std::ostream & operator<<(
    std::ostream & os,

    const BoundsBase & b
);

Updated on 2022-04-30 at 15:46:11 +0000