30[[nodiscard]]
inline std::optional<Bounds<T>>
merge(
const std::optional<
Bounds<T>> &a,
33 if (a.has_value() &&
b.has_value()) {
46[[nodiscard]]
inline std::optional<Bounds<T>>
min_max(
const std::optional<
Bounds<T>> &a,
58template<
typename T> [[nodiscard]]
inline std::optional<Bounds<T>>
min_max(
const Span<T> values)
69 Bounds<T> result = init;
70 for (const int i : range) {
71 math::min_max(values[i], result.min, result.max);
94 Bounds<T> result = init;
95 mask.slice(range).foreach_index_optimized<int64_t>(
96 [&](const int i) { math::min_max(values[i], result.min, result.max); });
106template<
typename T,
typename RadiusT>
120 Bounds<T> result = init;
121 for (const int i : range) {
122 result.min = math::min(values[i] - radii[i], result.min);
123 result.max = math::max(values[i] + radii[i], result.max);
138 if (!a.has_value() || !
b.has_value()) {
153template<
typename T,
int Size>
157 for (
int i = 0; i < Size; i++) {
169 if constexpr (std::is_integral<T>::value || std::is_floating_point<T>::value) {
170 return this->
max <= this->
min;
195 const T center = this->center();
196 const T new_half_size = this->
size() /
T(2) * scale;
203 this->
min = this->
center() - (new_size /
T(2));
204 this->
max = this->
min + new_size;
209 const T offset = new_center - this->
center();
214template<
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
local_group_size(16, 16) .push_constant(Type b
OrientationBounds merge(const OrientationBounds &cone_a, const OrientationBounds &cone_b)
ccl_device_inline float4 mask(const int4 mask, const float4 a)
Bounds< T > merge(const Bounds< T > &a, const Bounds< T > &b)
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)
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)