32[[nodiscard]]
inline std::optional<Bounds<T>>
merge(
const std::optional<
Bounds<T>> &a,
35 if (a.has_value() &&
b.has_value()) {
48[[nodiscard]]
inline std::optional<Bounds<T>>
merge(
const std::optional<
Bounds<T>> &a,
55[[nodiscard]]
inline std::optional<Bounds<T>>
min_max(
const std::optional<
Bounds<T>> &a,
67template<
typename T> [[nodiscard]]
inline std::optional<Bounds<T>>
min_max(
const Span<T> values)
78 Bounds<T> result = init;
79 for (const int i : range) {
80 math::min_max(values[i], result.min, result.max);
103 Bounds<T> result = init;
104 mask.slice(range).foreach_index_optimized<int64_t>(
105 [&](const int i) { math::min_max(values[i], result.min, result.max); });
115template<
typename T,
typename RadiusT>
129 Bounds<T> result = init;
130 for (const int i : range) {
131 result.min = math::min(values[i] - radii[i], result.min);
132 result.max = math::max(values[i] + radii[i], result.max);
156 if (!a.has_value() || !
b.has_value()) {
165template<
typename T>
inline std::optional<T>
max(
const VArray<T> &values)
177 std::numeric_limits<T>::min(),
178 [&](
const IndexRange range,
int current_max) {
179 for (const int value : values_span.slice(range)) {
180 current_max = std::max(current_max, value);
184 [](
const int a,
const int b) {
return std::max(a,
b); });
231template<
typename T,
int D>
246template<
typename T,
int Size>
250 for (
int i = 0;
i < Size;
i++) {
262 if constexpr (std::is_integral_v<T> || std::is_floating_point_v<T>) {
263 return this->
max <= this->
min;
288 const T center = this->center();
289 const T new_half_size = this->
size() /
T(2) * scale;
296 this->
min = this->
center() - (new_size /
T(2));
297 this->
max = this->
min + new_size;
302 const T offset = new_center - this->
center();
307template<
typename PaddingT>
__forceinline BoundBox intersect(const BoundBox &a, const BoundBox &b)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
constexpr const T & first() const
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
std::optional< T > get_if_single() const
OrientationBounds merge(const OrientationBounds &cone_a, const OrientationBounds &cone_b)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
Bounds< VecBase< T, 3 > > transform_bounds(const MatBase< T, D, D > &matrix, const Bounds< VecBase< T, 3 > > &bounds)
Bounds< T > merge(const Bounds< T > &a, const Bounds< T > &b)
std::array< VecBase< T, 3 >, 8 > corners(const Bounds< VecBase< T, 3 > > &bounds)
std::optional< Bounds< T > > min_max_with_radii(const Span< T > values, const Span< RadiusT > radii)
std::optional< Bounds< T > > min_max(const std::optional< Bounds< T > > &a, const T &b)
bool any_less_or_equal_than(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
T min(const T &a, const T &b)
T midpoint(const T &a, const T &b)
T max(const T &a, const T &b)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
Value parallel_reduce(IndexRange range, int64_t grain_size, const Value &identity, const Function &function, const Reduction &reduction)
static void init(bNodeTree *, bNode *node)
void scale_from_center(const T &scale)
void recenter(const T &new_center)
void resize(const T &new_size)
void pad(const PaddingT &padding)
void translate(const T &offset)
void translate(const T &offset)